In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/e54915d69d47bff3ed6ead9f15d7052ace251ac0?hp=7984ae89f04c4a0a0972f7df0051b8f307952830>
- Log ----------------------------------------------------------------- commit e54915d69d47bff3ed6ead9f15d7052ace251ac0 Author: Father Chrysostomos <spr...@cpan.org> Date: Mon Oct 6 08:28:40 2014 -0700 Deparse sub calls quietly In commit a958cfbb8 I used eval{prototype "CORE::..."} to see whether something is a keyword, not realising that we have a __DIE__ hand- ler that squeaks every time. It is only installed when Deparse is invoked via -MO. Localising $SIG{__DIE__} does the trick. Localising $@ as well is a good idea when using eval, though I havenât checked whether that was causing problems. ----------------------------------------------------------------------- Summary of changes: lib/B/Deparse.pm | 3 ++- lib/B/Deparse.t | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index b84217d..d5f290e 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -3905,7 +3905,8 @@ sub pp_entersub { my $fq; if (exists $feature_keywords{$kid}) { $fq++ if $self->feature_enabled($kid); - } elsif (eval { () = prototype "CORE::$kid"; 1 }) { + } elsif (do { local $@; local $SIG{__DIE__}; + eval { () = prototype "CORE::$kid"; 1 } }) { $fq++ } $fq and substr $kid, 0, 0, = $self->{'curstash'}.'::'; diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 75a5fc2..ef238bf 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -13,7 +13,7 @@ use warnings; use strict; use Test::More; -my $tests = 20; # not counting those in the __DATA__ section +my $tests = 21; # not counting those in the __DATA__ section use B::Deparse; my $deparse = B::Deparse->new(); @@ -277,6 +277,14 @@ is($deparse->coderef2text(sub{ use utf8; /â¬/; }), }', "qr/euro/"); +# STDERR when deparsing sub calls +# For a short while the output included 'While deparsing' +$a = `$^X $path "-MO=Deparse" -e "foo()" 2>&1`; +$a =~ s/-e syntax OK\n//g; +is($a, <<'EOCODI', 'no extra output when deparsing foo()'); +foo(); +EOCODI + done_testing($tests); -- Perl5 Master Repository