[sf-perl] How to find out what script is calling a subroutine?
Sergey Fetisov
sergey.fetisov at ask.com
Wed Sep 10 11:25:20 PDT 2008
Hi,
If I understood correctly - you're going to run the script containing
record_info subroutine from another script...
In this case you can do the next:
1. Run record_info_script with the command line argument:
`/path/record_info_script.pl $0`
2. Then use @ARGV in the record_info_script.
Otherwise (if there is only one script and you need just find out its
name) see $0 description.
Regards,
Sergei
________________________________
From: sanfrancisco-pm-bounces+sergey.fetisov=ask.com at pm.org
[mailto:sanfrancisco-pm-bounces+sergey.fetisov=ask.com at pm.org] On Behalf
Of Richard Reina
Sent: Wednesday, September 10, 2008 11:05 AM
To: sanfrancisco-pm at pm.org
Subject: [sf-perl] How to find out what script is calling a subroutine?
If I have a script such as
#!/usr/bin/perl -w
sub record_info {
# insert some into into a DB table
}
1;
Is there a way that the subroutine record_info can tell what perl script
called it so that it can also put that info in to the DB table?
Thanks very much for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20080910/55a2071e/attachment.html>
More information about the SanFrancisco-pm
mailing list