fix for Exporter's $SIG{__WARN__} handler
Exporter's $SIG{__WARN__} handler is too zealous. It fails here:
$ cat t
require Carp;
package Foo;
@ISA = qw(Exporter);
@EXPORT_OK = @EXPORT_FAIL = qw(foo);
sub export_fail {
my $self = shift;
Carp::carp("carp from export_fail");
return ();
}
package main;
import Foo 'foo';
$ perl5.00393 t
carp from export_fail at t line 16
at t line 16
This is because the carp() inside export_fail triggers Exporter's
__WARN__ handler which calls carp() a second time which adds the second
" at t line 16".
I was surprised to learn that carp() adds its string to an error message
which ends with a newline, I thought it followed warn()'s lead on that.
I checked 5.003 and it was the same there, too, though.
Also, shouldn't Exporter's __WARN__ handler increment $Carp::CarpLevel
rather than setting it to 1? I didn't include that in the patch because
I'm not sure, but it seems the right thing to do to me.
p5p-msgid: 2282.
858296451@eeyore.ibcinc.com