Tricks of the wizard

Tricks of the wizard

By Mark Jason Dominus from Philadelphia.pm
Date: Wednesday, 23 July 2003 14:15
Duration: 120 minutes
Language:




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'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 nine very small but useful enchantments
that take thirty seconds each.

o Short introduction

o Globs
o Operations with Globs; aliasing; exportation; forced importing.
o Perl 6
o Passing filehandles
o Globjects
o Wrappers
o Read-only constants
o Templating systems

o Ties
o ID-generating magic scalar
o Case-insensitive hash
o CGI.pm
o Modules that export magical variables: Config.pm
o Tied arrays
o Tied filehandles: 'tee'
o Silencing a noisy subroutine

o Autoloading
o Case-insensitive function names
o Function caching and magic 'goto'
o Function call tracing
o Accessor method construction
o Method code in files
o NEXT.pm
o Shell.pm

o Source Filters
o Filter::Simple
o Encrypted source code
o Filter::Util::Call
o Why "only 'perl' can parse Perl"
o Function tracing revisited
o Internationalization
o Perl6::Variables

o Cantrips
o Returning a False Value
o The Self-Replacing Stub
o Schwartzian Transform
o Debug Printing of Strings
o Debug Printing of Lists
o ?:?:?:
o Booleanumbers
o Local Effects
o Selecting n Different Things




Template talk/show last modified at 12:26:25 27-Jul-2013
All content copyright © 2003 Yet Another Society, Inc.
for any question about this site or YAPC::EU 2003, mail to <yapc-help@mongueurs.net>.
XHTML and CSS validation.