Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Trying to understand (caller($i))[4], a.k.a. $hasargs

by ikegami (Patriarch)
on Feb 13, 2012 at 10:12 UTC ( [id://953430]=note: print w/replies, xml ) Need Help??


in reply to Trying to understand (caller($i))[4], a.k.a. $hasargs

It indicates a lack of &f.

>perl -E"sub g { say +(caller 0)[4]?'':'no ', 'new @_; ', 0+@_, ' args +: ', @_ } sub f { g(@_) } f('abc');" new @_; 1 args: abc >perl -E"sub g { say +(caller 0)[4]?'':'no ', 'new @_; ', 0+@_, ' args +: ', @_ } sub f { &g } f('abc');" no new @_; 1 args: abc

Replies are listed 'Best First'.
Re^2: Trying to understand (caller($i))[4], a.k.a. $hasargs
by Oberon (Monk) on Feb 13, 2012 at 16:58 UTC
    It indicates a lack of &f.

    Excellent. That makes sense now; thanks for the concise explanation.

    Now, what about the Carp code? The OP code is drawn from 5.14.2, but I have the same issues in 5.12.4, and the Carp code is a bit simpler there:

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://953430]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-26 01:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found