I'm using caller() to get the name of the calling package and method, but
sometimes the info isn't there. My code looks something like this...
# Begin code example
##############################
package main;
use ModuleX 'logit';
logit("a message");
package ModuleX;
sub logit
{
my @caller = caller(1);
...do some stuff...
}
##############################
# End code example
In cases where it doesn't work (it almost always works) it returns 'ModuleX'
as the package instead of 'main'.
I am guessing the problem is (as stated in the perldoc) that "the optimizer
might have optimized call frames away before "caller" had a chance to get
the information.". Furthermore it states that ""caller(N)" might not return
information about the call frame you expect it do, for "N > 1"". ...But in
my case "N" never exceeds 1.
Any ideas?
Thanks.
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]