Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^5: caller() mystery

by JavaFan (Canon)
on Sep 26, 2008 at 10:55 UTC ( [id://713854]=note: print w/replies, xml ) Need Help??


in reply to Re^4: caller() mystery
in thread caller() mystery

that is, caller 0 says "who I am", i.e. which function is invoking caller

No, you are incorrect.

caller() doesn't return which 'function' calls you - it returns the package name, the file name and the line number of the caller; which is in the first three arguments. All the other arguments have to do how you are called. So, caller(0)[3] returns how you were called as.

If you want to find out which function called you (if there is such a function), you call caller(1), which gives you information how your caller is called.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-24 19:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found