I have a Perl script (standalone program) which contains some subs I'd like to reuse in other scripts. Due to limitations of the execution environment, I can't move the functions to a common .pm
file.
Is it possible to differentiate whether the script was run as a standalone program or it was require
ed/do
ed by another script?
The only thing I could find was to use caller
at the top level: standalone program doesn't have any caller while when require
ed caller
shows who did load the module. Is there any better solution?