While thinking about Exceptions, the fact that Error.pm can lead you to create closures if you don't pay close attention, the fact that however cool a Filter based Error module would force people to put it on the first line of every app that uses its exceptions (at least, if I've understood filters properly), and various other things (such as the problems Kip Hampton and I ran into recently due to the globalness of $@ which makes Perl exception rather brittle), I came to the conclusion that maybe the simplest solution would be to stick with Error.pm more or less as it is, but to have a way to be warned about created closures.
In fact, it would be useful beyond Error.pm. Closures are generally a bad idea for instance in mod_perl as they'll generate all sorts of memory leaks.
I have no idea how to detect the creation of a closure in Perl, but there must be a way as Perl itself probably knows that it's a closure. A simple Devel::Closure module could then be created, and with it a way to warn (or die, or call a callback, or... raise an exception) when a closure is created.
Anyone with the knowledge of how to do that is very
welcome to release such a module