(e-mail address removed) wrote:
[please! don't top post! snip all but the attribution and some
appropriate context and post your response underneath!]
ok, now I want more than the little finger, but the entire hand. can I
get a complete backtrace when I hit an unitialized string?
use Carp;
use warnings;
warnings::warn(&testd, "uninitialized");
sub testd { confess("you hit an uninit string.");}
sub myinerror { print "$2"; }
sub myouterror { myinerror(); }
myouterror();
I think now you have to write your own __WARN__ handler. Here's my
15-second crack at it, this likely needs some tweaking:
#!/usr/bin/perl
use strict;
use Carp;
use warnings;
$SIG{__WARN__} = sub {
if ( $_[0] =~ m{ uninitialized }x ) {
confess('you hit an uninitialized string');
}
else {
print STDERR $_[0];
}
};
myouterror();
sub myinerror { print "$2"; }
sub myouterror { myinerror(); }
__END__
-jp