Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Name of subpackage dependent on main package

by davido (Cardinal)
on Dec 29, 2019 at 23:34 UTC ( [id://11110740]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package My;
    
    ...
    my $mya = My::A->new({name => 'Dave'});
    $mya->greet();
    
  2. or download this
    my %subs = (
        new   => sub { # constructor goes here... },
    ...
        no strict 'refs';
        *{$pkg_sub . '::' . $name} = $code;
    }
    
  3. or download this
    {
        # ...
    ...
          *{"$class"."::"."$name"} = $code;
        }
      }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-24 16:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found