X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/4d737ff813fca9402d7f7b91391b73ea4e18b188..65ca2c1dad7ec0689fe20a8c311042e71819452f:/lib/Fatal.pm diff --git a/lib/Fatal.pm b/lib/Fatal.pm index d135731..69866d9 100644 --- a/lib/Fatal.pm +++ b/lib/Fatal.pm @@ -5,7 +5,7 @@ use Carp; use strict; our($AUTOLOAD, $Debug, $VERSION); -$VERSION = 1.04; +$VERSION = 1.05; $Debug = 0 unless defined $Debug; @@ -38,7 +38,7 @@ sub fill_protos { $n++; push(@out1,[$n,@out]) if $seen_semi; push(@out, $1 . "{\$_[$n]}"), next if $proto =~ s/^\s*\\([\@%\$\&])//; - push(@out, "\$_[$n]"), next if $proto =~ s/^\s*([*\$&])//; + push(@out, "\$_[$n]"), next if $proto =~ s/^\s*([_*\$&])//; push(@out, "\@_[$n..\$#_]"), last if $proto =~ s/^\s*(;\s*)?\@//; $seen_semi = 1, $n--, next if $proto =~ s/^\s*;//; # XXXX ???? die "Unknown prototype letters: \"$proto\""; @@ -99,7 +99,8 @@ sub _make_fatal { $sref = \&$sub; $proto = prototype $sref; $call = '&$sref'; - } elsif ($sub eq $ini) { # Stray user subroutine + } elsif ($sub eq $ini && $sub !~ /^CORE::GLOBAL::/) { + # Stray user subroutine die "$sub is not a Perl subroutine" } else { # CORE subroutine $proto = eval { prototype "CORE::$name" }; @@ -177,6 +178,12 @@ values are ignored. For example # not checked, so error raises an exception close FH; +=head1 BUGS + +You should not fatalize functions that are called in list context, because this +module tests whether a function has failed by testing the boolean truth of its +return value in scalar context. + =head1 AUTHOR Lionel Cons (CERN).