in reply to How to tell if a sub has been exported?

You could write a custom import. You could have an import that wraps around the usual Exporter with an appropriate goto to fool it into exporting to the right package. You could use the trick that Carp uses internally to handle "verbose" (namely having a failure to export method).

But while all of those answer the asked question, I think that the best two solutions are either:

my $foo_is_init; sub foo { $foo_is_init = init_foo() unless $foo_is_init; # etc }
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.)