[sf-perl] How to find out what script is calling a subroutine?

Shlomi Fish shlomif at iglu.org.il
Wed Sep 10 11:20:30 PDT 2008


Hi!

On Wednesday 10 September 2008, Richard Reina wrote:
> 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?

See $0 in http://perldoc.perl.org/perlvar.html or 
http://perldoc.perl.org/functions/caller.html

Regards,

	Shlomi Fish

>
> Thanks very much for your help.

-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
Best Introductory Programming Language - http://xrl.us/bjn84

Shlomi, so what are you working on? Working on a new wiki about unit testing 
fortunes in freecell? -- Ran Eilam


More information about the SanFrancisco-pm mailing list