in reply to Detection of main script / libraries

You could find the executed perl-Scriptpath with the module: FindBin:
use FindBin (); # get actual path of this script print "Path of script is: $FindBin::Bin\n"; # no namespace pollution
or just use: $0 for the filename.

Otherwise, you could set a global Variable in the main-package (e.g. assign $0 to it) and ask it in every packages BEGIN-Block if it is already defined... Best regards,
perl -le "s==*F=e=>y~\*martinF~stronat~=>s~[^\w]~~g=>chop,print"