Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

darobin (1316)

  (email not shown publicly)

Journal of darobin (1316)

Saturday November 03, 2001
12:28 PM

Devel::Closures anyone ?

[ #1160 ]

While thinking about Exceptions, the fact that 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 more or less as it is, but to have a way to be warned about created closures.

In fact, it would be useful beyond 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 :-) Of course, pointing me to information that would allow me to figure it out by myself would also be very welcome.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.