in reply to How to tell if a sub has been exported?
But while all of those answer the asked question, I think that the best two solutions are either:
or else just don't have a foo and have an AUTOLOAD method which will lazily create and initialize foo. (ie Don't have your hook on exporting, have it on the first call to the function.)my $foo_is_init; sub foo { $foo_is_init = init_foo() unless $foo_is_init; # etc }
|
|---|