From: "Chas. Owens" <[EMAIL PROTECTED]>
> On Tue, Dec 2, 2008 at 09:23, Chas. Owens <[EMAIL PROTECTED]> wrote:
> > On Tue, Dec 2, 2008 at 09:11, Deviloper <[EMAIL PROTECTED]> wrote:
> >> Hi!
> >>
> >> Is there a special variable or trick to get the name of the current scope 
> >> or subroutine name?
> >>
> >> Thanks,
> >> B.
> >>
> >
> > The caller* function will tell you information about the call stack
> > (including the current function):
> snip
> 
> Sometimes I answer without questions with giving a lot of thought to
> what may be the driving cause for the question.  What do you want to
> know the function name for? debugging? (a real debugger is better than
> print statements)

Not always. Imagine a multithreaded/forking application. Or a program 
that only works or only exhibits the problem in a special context in 
which you cannot attach the debuger. (Windows Service/daemon, remote 
machine).

A nice, well positioned

print "blah blah\n" if DEBUG;

can help a lot at times.


When it comes to logging (for debugging purposes) 
http://search.cpan.org/search?query=Devel::TraceSubs&mode=all may be 
easier.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to