From b3980c394843d18896023d060cf87f3a509acec8 Mon Sep 17 00:00:00 2001 From: Yves Orton Date: Mon, 23 May 2005 13:43:56 +0200 Subject: [PATCH] Re: [perl #35857] [PATCH] B::Deparse doesnt handle warnings register properly. Message-ID: <9b18b31105052302431fb0a3c2@mail.gmail.com> p4raw-id: //depot/perl@24559 --- ext/B/t/deparse.t | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/ext/B/t/deparse.t b/ext/B/t/deparse.t index cf6843a..6167a64 100644 --- a/ext/B/t/deparse.t +++ b/ext/B/t/deparse.t @@ -24,7 +24,7 @@ use warnings; use strict; use Config; -print "1..37\n"; +print "1..39\n"; use B::Deparse; my $deparse = B::Deparse->new() or print "not "; @@ -130,6 +130,37 @@ $1/ if $Is_MacOS; print "# [$a]\n\# vs expected\n# [$b]\nnot " if $a ne $b; print "ok " . $i++ . "\n"; +#Re: perlbug #35857, patch #24505 +#handle warnings::register-ed packages properly. +package B::Deparse::Wrapper; +use strict; +use warnings; +use warnings::register; +sub getcode { + my $deparser=B::Deparse->new(); + return $deparser->coderef2text(shift); +} + +package main; +use strict; +use warnings; +sub test { + my $val=shift; + my $res=B::Deparse::Wrapper::getcode($val); + print $res=~/use warnings/ ? '' : 'not ',"ok\n"; +} +my ($q,$p); +my $x=sub { ++$q,++$p }; +test($x); +eval <