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->( @_ ); }