use Scope::Guard; my $sg = Scope::Guard->new( sub { warn "hogehoge"; });
とすると$sg がscopeから抜けるとき(このコードだとexitしたとき)にcoderefが実行される。すごい!
use Scope::Guard; my $sg = Scope::Guard->new( sub { warn "hogehoge"; });
とすると$sg がscopeから抜けるとき(このコードだとexitしたとき)にcoderefが実行される。すごい!