From: Yves Orton Date: Mon, 23 May 2005 11:43:56 +0000 (+0200) Subject: Re: [perl #35857] [PATCH] B::Deparse doesnt handle warnings register properly. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b3980c394843d18896023d060cf87f3a509acec8;p=p5sagit%2Fp5-mst-13.2.git Re: [perl #35857] [PATCH] B::Deparse doesnt handle warnings register properly. Message-ID: <9b18b31105052302431fb0a3c2@mail.gmail.com> p4raw-id: //depot/perl@24559 --- 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 <