Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Getting module to call importer's function

by etcshadow (Priest)
on Sep 22, 2004 at 21:06 UTC ( [id://393050]=note: print w/replies, xml ) Need Help??


in reply to Getting module to call importer's function

I think that:
sub x { my $package = caller; return unless UNIVERSAL::can($package, "_x"); ... eval "${package}::_x"; die $@ if $@; }
Is what you're looking for.
------------ :Wq Not an editor command: Wq

Replies are listed 'Best First'.
Re^2: Getting module to call importer's function
by chromatic (Archbishop) on Sep 22, 2004 at 23:22 UTC

    That's potentially too smart by half.

    sub x { my $package = caller(); my $sub = $package->can( '_x' ); return unless defined $sub; $sub->( @_ ); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-23 17:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found