in reply to Re: useless Useless warningin thread useless Useless warning
use strict; use warnings; BEGIN { package My::Guard; sub new {} } { my $sth; my $guard1 = My::Guard->new(sub { $sth->finish }); my $guard2 = My::Guard->new(sub { $guard1; }); } [download]
>perl script.pl > [download]
By the way, My::Guard already exists as ReleaseAction, Object::Destroyer, AtExit, Scope::Guard, Sub::ScopeFinalizer, etc.