Mark-Jason Dominus, Chief Programmer, Plover Systems Co.
Track: Perl
Date: Tuesday, July 27
Time: 1:45pm - 5:15pm
Location: Mt. Hood
TrackBack
This class will explore Perl's most unusual features. We'll look at some of the standard modules written by famous wizards like Tom Christiansen, Damian Conway, and Larry Wall, and learn what they're for and how they work.
First we'll investigate Perl's remarkable 'glob' feature. We'll see many uses of globs, including the 'Exporter' module, which everyone uses but hardly anyone understands. We'll discuss how to accomplish the same globby magic in Perl 6, which won't have globs.
After this we'll look at unusual uses of Perl's 'tie' function, which scoops the brain out of an ordinary Perl array, hash, or filehandle, replacing it with your own concoction. We'll make hashes with case-insensitive keys, arrays that mirror the contents of a file, and filehandles that suppress annoying output.
Then we'll learn about AUTOLOAD, Perl's function of last resort. We'll see a tremendously useful application: How to generate the accessor methods of a class without writing pages of repetitive code. We'll see how Larry Walls's 'Shell' module uses AUTOLOAD to emulate the Unix shell inside Perl scripts, and how Damian Conway's 'NEXT' module uses AUTOLOAD for method redispatch.
Section 4 discusses Perl's new "source filter" feature. This magic allows you to write Perl programs in any language, and translate them to Perl at the last moment. We'll add a 'switch' statement to Perl and we'll see how Perl 5 can emulate the variable syntax of Perl 6.
The class will finish with ten very small but useful enchantments that take thirty seconds each.