Re: Name of current sub

2006-11-15 Thread Mumia W.
On 11/15/2006 03:06 AM, Nigel Peck wrote: Is there a way to get the name of the current sub? So: sub test_sub { $subname = ???; print $subname; # prints test_sub? } Took a look through Programming Perl and Googled it but couldn't find the answer. TIA Nigel $subname = (caller 0)[

Re: Name of current sub

2006-11-15 Thread Nigel Peck
I wrote: Is there a way to get the name of the current sub? So: sub test_sub { $subname = ???; print $subname; # prints test_sub? } Sorry, just found it: http://www.unix.org.ua/orelly/perl/cookbook/ch10_05.htm sub test_sub { $subname = (caller(0))[3]; print $subname; # prin

Name of current sub

2006-11-15 Thread Nigel Peck
Is there a way to get the name of the current sub? So: sub test_sub { $subname = ???; print $subname; # prints test_sub? } Took a look through Programming Perl and Googled it but couldn't find the answer. TIA Nigel -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: Name of current sub?

2001-11-22 Thread Scott R. Godin
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Chuck Tomasi) wrote: > I find myself writing this sort of thing a lot: > > print STDERR "program.pl: subname(): debug statement\n"; > > I know $0 can be used for programname.pl (except it returns the full path to > the program), is there some

RE: Name of current sub?

2001-11-21 Thread Tomasi, Chuck
It turns out that (caller 0)[3] got me pretty close to what I was looking for. Thanks. > -Original Message- > From: Bob Showalter [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, November 21, 2001 11:06 AM > To: 'Tomasi, Chuck'; '[EMAIL PROTECTED]' &g

RE: Name of current sub?

2001-11-21 Thread Bob Showalter
> -Original Message- > From: Tomasi, Chuck [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, November 21, 2001 12:02 PM > To: '[EMAIL PROTECTED]' > Subject: Name of current sub? > > > I find myself writing this sort of thing a lot: > > print STDERR &

Name of current sub?

2001-11-21 Thread Tomasi, Chuck
I find myself writing this sort of thing a lot: print STDERR "program.pl: subname(): debug statement\n"; I know $0 can be used for programname.pl (except it returns the full path to the program), is there some cool variable to get my hands on the name of the current sub? --Chuck -- To unsubsc