in reply to Autoloading tie routines
You write something like this:sub AUTOLOAD { my @name_pieces = split /::/, $AUTOLOAD; my $function = pop @name_pieces; my $package = join "::", @name_pieces; no strict 'refs'; *{"$package\::$function"} = get_sub($package, $function); goto &{"$package\::$function"}; }
and now there is no need to write an AUTOLOAD. Which means that chromatic doesn't complain that can doesn't do the right thing, your AUTOLOAD doesn't break when it sees functions you didn't mean to catch, you don't blow the method cache a bunch of times, and life is generally better.for my $package (@packages) { for my $function (@functions) { no strict 'refs'; *{"$package\::$function"} = get_sub($package, $function); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Autoloading tie routines
by cmac (Monk) on Feb 02, 2009 at 20:43 UTC | |
by tilly (Archbishop) on Feb 03, 2009 at 02:03 UTC | |
by cmac (Monk) on Feb 03, 2009 at 06:27 UTC | |
by tilly (Archbishop) on Feb 03, 2009 at 16:28 UTC | |
by cmac (Monk) on Feb 03, 2009 at 18:50 UTC | |
|