Scope::Guard - scopeから抜けるときにcoderefを実行する

use Scope::Guard;
my $sg = Scope::Guard->new( sub { 
  warn "hogehoge";
});

とすると$sg がscopeから抜けるとき(このコードだとexitしたとき)にcoderefが実行される。すごい!