http://qs321.pair.com?node_id=585873


in reply to Re: Re: trapping -w warnings
in thread trapping -w warnings

I liked this enough that I bookmarked this in my delicious collection -- helped me debug a nasty problem.

I did things slightly differently though -- more localized, I think.

{ local $SIG{__WARN__} = sub { my @warnings = @_; foreach my $warning (@warnings) { print "got a warning: $warning\n"; } }; eval {'' =~ /$re/ }; }
cheers.