Re: Special Var with Name of current scope or name of subroutine?



From: "Chas. Owens" <chas.owens@xxxxxxxxx>
On Tue, Dec 2, 2008 at 09:23, Chas. Owens <chas.owens@xxxxxxxxx> wrote:
On Tue, Dec 2, 2008 at 09:11, Deviloper <deviloper@xxxxxxxxxx> 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
===== Jenda@xxxxxxxxxxx === 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

.



Relevant Pages

  • Re: Debugging with g95 on windows
    ... install gdb. ... and you compile your programs in a terminal ... For now, print statements worked just fine for me, but if someone ... effectively work with gdb or some other debugging tool can ...
    (comp.lang.fortran)
  • Re: upload file rom solaris to debian using perl base install
    ... 'debuggerless debugging' with the help of suitable debugging code. ... subroutine invocation: There is always at least an empty parenthesis ... This is less helpful in Perl than in Pascal ... This is a set of opinion statements. ...
    (comp.lang.perl.misc)
  • Re: Gates Wants Higher Educational Standards
    ... so when it came to debugging? ... I also do things like adding extra print statements or break points so ... but I bet you still use the "mental binary search". ... people don't think of HOW they troubleshoot, ...
    (sci.research.careers)
  • Re: clisp debugger
    ... print statements are better than stepping. ... Anybody interested in debugging should watch google's video "Debugging ... PRINT _expressions_ and TRACE are basically a crude way to do that. ...
    (comp.lang.lisp)
  • RE: Debbuging
    ... Different code, different debugging. ... WHen doing dynamic SQL, use print statements before instead of actually ... executing the code, of course this is not possible when code further in your ...
    (microsoft.public.sqlserver.programming)