sub my_die{ ..... } local ($SIG{__DIE__}) = \&my_die; local ($SIG{__WARN__}) = \&my_warn; local ($SIG{INT}) = \&my_kill; local ($SIG{TERM}) = \&my_kill; die "test";