Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Getting module to call importer's function

by etcshadow (Priest)
on Sep 22, 2004 at 21:06 UTC ( #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
Node Status?
node history
Node Type: note [id://393050]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2019-09-15 09:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (180 votes). Check out past polls.

    Notices?