On Tue, 18 Nov 2003, Simon Cozens wrote:
> [EMAIL PROTECTED] (Austin Hastings) writes:
> > This is what I was talking about when I mentioned being able to do:
> > &cleanup .= { push @moves: [$i, $j]; }
>
> This reminds me of something I thought the other day might be useful:
>
> $cleanup = bless {}, class {
> method DESTROY { ... }
> };
>
> Of course, it probably wouldn't work in this context because you couldn't
> guarantee that the destructor will be called at the point of loop exit, but I
> like the anonymous class syntax anyway.
$cleanup = bless {}, class : impatient {
method DESTROY { ... }
};
That'll probably do it, at the expense of extra runtime block exit
overhead until the object dies. If you just want a block exit action,
then:
add_block_exit_action(\&foo);
or something similar will do it. (Though we could add new syntax for it if
you really want... :-)
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk