Rob Hanson wrote:
> 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. > actually, the optimizer didn't optimized the frames. the number you pass to caller tells Perl how many levels atop of the current call for the info. for example: my @stuff = caller(0); is the same as: my @stuff = caller; which means 0 level up of the call tree so you get what you expect, ie, it gives you the information of the function's direct caller. when you say: my @stuff = caller(1); you said give me the parent of the parent (the 1 means one level up of the direct caller) and this could return nothing. consider: #!/usr/bin/perl -w use strict; sub fun{ my @stuff = caller(1); print join("\n",@stuff),"\n" if(@stuff); } fun __END__ prints nothing because there is no 2 level caller tree. you can visualize the number as the index to the caller tree. a 1 means the second level of the caller. 0 means the first level of the caller tree. in fact, Perl's default array index machanism works the same way, 0 means the first element, 1 means the second element, etc. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]