O enlightened masters of the Perl core:
This is a deep one. I'm trying to understand the $hasargs element of the return from caller (when called in a list context). The man page contains this tantalizing nugget:
$hasargs is true if a new instance of @_ was set up for the frame.Which almost tells me something ... but then again not quite. Google searches have likewise proved fruitless.
The reason I'm hot on the trail of $hasargs is that it seems linked to this code from Carp.pm:
if ( $call_info{has_args} ) { my @args; if ( @DB::args == 1 && ref $DB::args[0] eq ref \$i && $DB::args[0] == \$i ) { @DB::args = (); # Don't let anyone see the address of $ +i local $@; my $where = eval { my $func = $cgc or return ''; my $gv = B::svref_2object($func)->GV; my $package = $gv->STASH->NAME; my $subname = $gv->NAME; return unless defined $package && defined $subname; # returning CORE::GLOBAL::caller isn't useful for trac +ing the cause: return if $package eq 'CORE::GLOBAL' && $subname eq 'c +aller'; " in &${package}::$subname"; } // ''; @args = "** Incomplete caller override detected$where; \@DB: +:args were not set **"; } else { @args = map { Carp::format_arg($_) } @DB::args; } if ( $MaxArgNums and @args > $MaxArgNums ) { # More than we want to show? $#args = $MaxArgNums; push @args, '...'; } # Push the args onto the subroutine $sub_name .= '(' . join( ', ', @args ) . ')'; }
See that message in the middle there? about "incomplete caller override"? I keep seeing that when I try to look at my code in the debugger. And I deeply suspect it's coming from (indirectly) Hook::LexWrap, where the Damian is indeed overriding caller. I'm not sure why Carp think it's being overridden incompletely, but it obviously has something to do with $hasargs, and I feel like if I could just understand WTF that is, I'd understand WTF is going on in the code.
Thanks to anyone who has the insight into perlguts to help me out.
In reply to Trying to understand (caller($i))[4], a.k.a. $hasargs by Oberon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |