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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.