Subject: | stripping \n from warning when other $SIG{__WARN__} in use |
This code:
perl -wle'use Test::Warnings ":no_end_test"; use Devel::Confess; warn "foo"'
gives:
foo at /Users/ether/.perlbrew/libs/21.5@std/lib/perl5/Test/Warnings.pm line 59.
Test::Warnings is doing nothing here but installing a __WARN__ handler that calls warn($_[0]. The problem is that the trailing \n, along with correct location information, is being stripped by Devel::Confess.
I am changing Test::Warnings to call Carp::carp($msg) if there is no newline, but I think it is an error that a message would ever hit a warning handler without this information.