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

I believe a better way to do this is to write your own import method, and catch what it is called with... for instance...
use FOO qw(bar); bar();
And in FOO.pm
package FOO; use base Exporter; our @EXPORT_OK = qw(bar); sub import { print "Exporting the following from @_\n"; FOO->export_to_level(1, @_); } sub bar { print "Hello world\n"; } 1;
Exporter gives you the export_to_level method to allow you to override import like this. Now you can examine the list import is called with at compile time and set things up accoringly.

Realize, of course, that bar can be called without being exported, using FOO::bar()... you probably should do something along the lines of initializing if it is exported, and initializing it on the first call if it is called without being initialized properly. You can do tricks with AUTOLOAD and the like that can be fun :)

                - Ant
                - Some of my best work - Fish Dinner