From: Tom Christiansen [mailto:tchrist@chthon.perl.com] > >Could you give an example of the usage of the code that illustrates the > >problem please Tom. > > Right, sorry. It was snipped from yesterday's pathedit program. > > #!/usr/bin/perl > > use warnings; > no warnings 'redefine'; > > use Carp; > > my @names = qw(/tmp/foo /tmp/bar); > my $code = q{$a + $b}; > > print "Trying compile with fatal warnings\n\n"; > eval { > compile1($code); > pathedit() for @names; > }; > warn if $@; > > print "\nTrying compile with sigwarn\n\n"; > eval { > compile2($code); > pathedit() for @names; > }; > warn if $@; > > sub compile1 { > my $op = shift; > *pathedit = eval qq{ > sub () { > use warnings qw/FATAL all/; # XXX: does not work > $op; > } > } || do { > local $_ = $@; > s/at \(eval.*//s; > die "$0: can't compile perlexpr $op: $_\n"; > } > } > > sub compile2 { > my $op = shift; > *pathedit = eval qq{ > sub () { > local \$SIG{__WARN__} = sub { > local \$_ = "\@_"; > s/at \\(eval.*//; > confess "FATAL WARNING: \$_"; > }; > $op; > } > } || do { > local $_ = $@; > s/at \(eval.*//s; > die "$0: can't compile perlexpr $op: $_\n"; > } > } > > That produces this: > > Trying compile with fatal warnings > > Use of uninitialized value in addition (+) at (eval 1) line 4. > Use of uninitialized value in addition (+) at (eval 1) line 4. > Use of uninitialized value in addition (+) at (eval 1) line 4. > Use of uninitialized value in addition (+) at (eval 1) line 4. > > Trying compile with sigwarn > > FATAL WARNING: Use of uninitialized value in addition (+) > main::__ANON__('Use of uninitialized value in addition (+) at (eval 2) line 8.^J') called at (eval 2) line 8 > main::__ANON__() called at /tmp/p line 21 > require 0 called at /tmp/p line 19 > ...caught at /tmp/p line 23. > > The question is: shouldn't the fatal warnings version also be, well, fatal? Indeed they should. The logic that processes "FATAL all" is broken. Expect a patch in the next couple of days. Paul