in reply to Re: How to Find the Script that Called it
in thread How to Find the Script that Called it

The reason is that there are about 10 scripts that is calling the main script. So, if I try to pass an argument, then it means I have to change the 10 scripts on how it is calling the main script.

I certainly can do that but it means I have to test the 10 scripts...
  • Comment on Re^2: How to Find the Script that Called it

Replies are listed 'Best First'.
Re^3: How to Find the Script that Called it
by runrig (Abbot) on Dec 18, 2008 at 01:42 UTC
    You can set an environment variable in the one parent script that you're looking for. E.g. $ENV{RUNNING_FROM_FOO}=1; in foo.pl, then in bar.pl test if ($ENV{RUNNING_FROM_FOO}) { ... }.

    Update: I see the Joost already suggested an environment variable, but you seem to have missed it (as did I). So it's probably worth saying again anyway :-)

      Thank you all for your suggestions.