Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Is it legal to create subs in a module?

by merlyn (Sage)
on Oct 11, 2001 at 19:27 UTC ( [id://118233]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    eval "sub $action { my \$pkg = shift; return(\$pkg->{\"$action\"}); }"
    +;
    
  2. or download this
    {
      my $action = "whatever";
      no strict 'refs';
      *{$action} = sub { my $pkg = shift; return $pkg->{$action}; };
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://118233]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-19 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found