All the Perl that's Practical to Extract and Report

Navigation

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.

Please Log In to Continue

I think I use a bunch of recursive closures in HTML::Element. The trick is that (unless you use a Y-operator, which is fiendish) once you define this:

my $x; $x = sub {... $x->(...)... };

...you've just defined a circular data structure. So once you're finished with the whole excursion of calling $x, you have to undef $x or the sub-object doesn't get destroyed -- at least last I checked.

Do you happen to have an example of the use of one of these fiendish Y operators in Perl? (If you don't, don't feel compelled to write one if you don't want to, I'm mostly only curious for curiosity's sake.)