Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • If at the top level, you check caller(), you'll find it is false if the script is run as a standalone program, and true if it's loaded as a library.

    Thus, do this at the top level:

    unless(caller) {
       # former top level
       print "Run as a script\n";
    } else {
       # you may drop this if you don't need it
       print "Initializing as a library file\n";
    It'll work now.