Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^5: caller() mystery

by JavaFan (Canon)
on Sep 26, 2008 at 10:55 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2020-05-30 19:21 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (173 votes). Check out past polls.