in reply to autoload usage
Also, if you know the function names beforehand, there is no need to use AUTOLOAD. For simple object accessors, there is Class::Accessor and for others stuff you can do it like this:
#!perl -w use strict; sub gen_func { my ($package,$name,$code) = @_; no strict 'refs'; *{"$package\::$name"} = $code; }; sub gen_printer { my ($package,$name) = @_; gen_func( $package, $name, sub { print "Hello $name\n" }); }; gen_printer(__PACKAGE__, 'ree'); ree();
|
|---|