Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^5: caller() mysteryby JavaFan (Canon) |
on Sep 26, 2008 at 10:55 UTC ( [id://713854]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|