Maybe I'm missing something, but doesn't this work?
use strict;
use warnings;
sub routine1 {
print "Calling routine2...\n";
routine2();
print "Done\n";
}
sub routine2 {
print "\tCalled by ", (caller(1))[3], "\n";
}
routine1();
output:
Calling routine2...
Called by main
>
=>------------
=>-
=>Artificial Intelligence is no match for Natural Stupidity.
=>
=>-
=>
=>
=>- Original Message --
--- Rajeev Rumale <[EMAIL PROTECTED]> wrote:
> Thanks Dwalu,
>
> But the what i need is the grep the name of the sub which is calling the
> loging sub.
> As you have suggested "caller" only gives only the name of current sub
> routine that is &debugLogger it self.
> And I had to do call the "cal
t. I know that's a lot more work, but
it might solve the problem.
- Original Message -
From: Rajeev Rumale <[EMAIL PROTECTED]>
To: Dwalu Z. Khasu <[EMAIL PROTECTED]>
Cc: Beginners-Cgi (E-mail) <[EMAIL PROTECTED]>
Sent: Saturday, July 07, 2001 1:22 AM
Subject: Re:
Hello Rajeev,
Saturday, July 07, 2001, Rajeev Rumale <[EMAIL PROTECTED]> wrote:
RR> But the what i need is the grep the name of the sub which is calling the
RR> loging sub.
do you read perldoc -f caller?
[...]
RR> sub debugLogger {
RR> my $message = "@_";
RR> $sub_name = ""; # Get t
-
- Original Message -
From: "Dwalu Z. Khasu" <[EMAIL PROTECTED]>
To: "Rajeev Rumale" <[EMAIL PROTECTED]>
Cc: "Beginners-Cgi (E-mail)" <[EMAIL PROTECTED]>
Sent: Monday, August 06, 2001 3
See perldoc -f caller
On Mon, 6 Aug 2001, Rajeev Rumale wrote:
=>Hello Every Body,
=>
=>I need some help.
=>I am using a sub routine to log all the messages to be used for debugging
=>purpose.
=>ie. &debugLogger($debug_message);
=>Since very similare kind of messages are genrated at serveral pl
Hello Every Body,
I need some help.
I am using a sub routine to log all the messages to be used for debugging
purpose.
ie. &debugLogger($debug_message);
Since very similare kind of messages are genrated at serveral places, I add
the function name.
i.e., &debugLogger("inside x \n $debug_messa