The problem with anonymous subs is that it still messes up caller() information and will display the line where the sub was defined as the error source. And rebuilding the behavior with prototypes leaves me basically with the same problem.
I had a look at the source of Carp to see how it deals with that, and it seems that most of the (evil) magic comes from goto jumps and tracking the callers package name to exclude calls from those that are considered 'internal' (i.e. Carp itself).
And since this all has already been invented, written and debugged, I'll go back to loading Carp and referencing to either carp() or croak() (which works as intended).
Thinking about it, I'd guess that core functions 'live' in a different memory space than functions and variables generated on compile / run. So it probably makes good sense that you can't take a reference to them.
It's just a bit 'disappointing' to run into some kind of limit in a language that seems to have none ;)
Thanks alot for the replies! | [reply] |