in reply to Filename of parent script available?
You could "sorta" modularize your sendmail.pl. Wrap the main logic of that script into a function (say, sendmail_main()), and add a line like this at the top of that function:
my @ARGV = @_;
Then, in your calling script, you can:
require 'sendmail.pl'; sendmail_main(@args);
Inside of Sendmail, you can use caller to discover the name of the calling file.
I highly suggest, however, that you fully modularize your script; you could always use create a new sendmail.pl that did something like:
use Sendmail; Sendmail::send_mail(@ARGV);
if you still need to call the script separately.
|
|---|