Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The question is: how can a subroutine find out the name of it's caller? (I'm not looking for the solution when the caller sub puts it's name in an argument)
To clarify my question, suppose there we have theses subs:
How should the LOG sub look like when I want to see this output:sub LOG; sub do_this { ....; ....; LOG "a message"; } sub do_that { ....; ....; LOG "another message..."; }
Thanks for your trouble.LOG: sub "do_this" says: "a message" LOG: sub "do_that" says: "another message..."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how can a subroutine find out the name of it's caller?
by Mutant (Priest) on Feb 18, 2005 at 12:32 UTC | |
|
Re: how can a subroutine find out the name of it's caller?
by jbrugger (Parson) on Feb 18, 2005 at 13:03 UTC | |
|
Re: how can a subroutine find out the name of it's caller?
by friedo (Prior) on Feb 18, 2005 at 13:04 UTC | |
|
Re: how can a subroutine find out the name of it's caller?
by perlsen (Chaplain) on Feb 18, 2005 at 13:33 UTC |