in reply to CGI::Application same function code
sub install_method { my $package = shift; foreach my $method (@_) { no strict 'refs'; *{$package . '::' . $method} = sub { # Do whatever you want here. You can reference $method and + any other # lexical variables, just like any closure. }; } } __PACKAGE__->install_method qw( start middle end );
Generally, I will put install_method() in my CGIApp baseclass. (You do have a CGIAPP baseclass, right?)
Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI::Application same function code
by boboson (Monk) on Feb 13, 2005 at 12:03 UTC | |
by dragonchild (Archbishop) on Feb 13, 2005 at 20:16 UTC | |
by boboson (Monk) on Feb 15, 2005 at 09:25 UTC |