in reply to Detection of main script / libraries

Howdy, Okay, let me follow up a bit on my earlier response. Doing
__FILE__ eq $0 and main();
should work for what you are trying to do. This will tell you if the file (not the package) was executed directly. Your scripts will need to do:
BEGIN { require "myfile" }
before you can call any of the subroutines because
use myfile;
insists on slapping on the .pm extension.

Cheers,
Hrakaroo