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::routine1
Done
Peter C.
> You could pass two arguments to the debugLogger, one the
> message, and the
> other the sub name. So it would be:
>
> sub x{
> stuff
> $sub_name = ""; # Get the subroutine name.This is what i
> need to grep.
> debugLogger($sub_name, $message);
> }
>
> Then the debugLogger just has to print. I know that's a lot
> more work, but
> it might solve the problem.
>
>
>
> ----- Original Message -----
>
> > 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 "caller" before calling the
> "debugLogger" and
> pass
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]