in reply to Re: unimport warnings in another package
in thread unimport warnings in another package

Thanks for the reply ... I thought of that, too, but I don't really want to turn off *all* warnings, just the one I want in the scope I want. I suppose I can store off the original handler, go crazy, and re-assign the warn handler to turn warnings back 'on'. I suppose I don't want to go down that road if I don't have to, though.

Thanks again, though!

---------
perl -le '$.=[qw(104 97 124 124 116 97)];*p=sub{[@{$_[0]},(45)x 2]};*d=sub{[(45)x 2,@{$_[0]}]};print map{chr}@{p(d($.))}'

Replies are listed 'Best First'.
Re^3: unimport warnings in another package
by diotalevi (Canon) on Mar 21, 2007 at 15:42 UTC

    If you just localize it with local $SIG{__WARN__} = ... then it'll clean itself up without any work required by you. Further... if you really wanted to you could assign your own sub and filter out just the warnings you want to ignore.

    local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /^Subroutine .+ redefined/; }

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊