Skip to content

Instantly share code, notes, and snippets.

@tyru
Created February 24, 2009 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyru/69353 to your computer and use it in GitHub Desktop.
Save tyru/69353 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
{
local $SIG{__WARN__} = sub {
my $errmsg = shift;
print "__WARN__:$errmsg";
};
warn "foo"; # $SIG{__WARN__}が呼ばれる
}
{
local $SIG{__DIE__} = sub {
my $errmsg = shift;
print "__DIE__:$errmsg";
};
# $SIG{__DIE__}が呼ばれる(evalの中からでも)
eval { die "bar" };
local $¥ = "¥n";
print '$@:' . $@;
}
local $¥ = "¥n";
print "continue.";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment