I want to be able to do this:
if ( wantarray(2) ) { ... }
Like caller, you could specify how many frames back you want to test. I find I need that at times when I'm refactoring. wantarray doesn't allow you to do this. However, in looking at the Want module, I've discovered that there is an undocumented function called want_uplevel. This may be exactly what I need!
You can use (caller[2])[5]
, though it's not nearly as self-documenting.
Re:caller()
Ovid on 2007-10-07T16:32:56
D'oh! That's particularly embarrassing since I'm the author of Perl6::Caller and should know how it works
:)