A Continental Perl Adventure Day One 28 of 96 : [PREV] [NEXT]

Simple Autoload example

@funcs = qw{ red yellow blue };

sub red { ... }
sub yellow { ... }
sub blue { ... }

sub AUTOLOAD {
  die "Function $AUTOLOAD unknown; try [@funcs]\n";
}

now if you do

green(...);

you'll get

Function main::green unknown; try [ red yellow blue ]

© 2003 Barbie barbie@missbarbell.co.uk Home http://birmingham.pm.org/