in reply to Chaining/Stacking $SIG{__WARN__}

That depends on what you mean by play nicely. This will restore the previous signal handlers after leaving your function.

sub do_something { local $SIG{__WARN__} = sub { ... }; # your stuff goes here ... } # previous version restored
If you want to have your handler called and then the original then you will need to do a bit more work
my $old_warn = $SIG{__WARN__}; $SIG{__WARN__} = sub { # your stuff $old_warn->(@_); }