Is there a way to determine if your perl script is being run directly:
or called from another script:
during runtime?
I have some scripts that can either be called directly or via a "require". The script has a return(1) in it...which is perfect for the require, but gets a "can't return outside a subroutine" warning if run directly. So, if I can determine how it is being run, I can determine if I need to "exit" or "return"...if that makes sense.
Code:
./script.pl
Code:
require("script.pl");
I have some scripts that can either be called directly or via a "require". The script has a return(1) in it...which is perfect for the require, but gets a "can't return outside a subroutine" warning if run directly. So, if I can determine how it is being run, I can determine if I need to "exit" or "return"...if that makes sense.