Skip Menu |

This queue is for tickets about the Attribute-Util CPAN distribution.

Report information
The Basics
Id: 74232
Status: resolved
Priority: 0/
Queue: Attribute-Util

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.06
Fixed in: (no value)



Subject: Bleadperl v5.15.6-147-g415d4c6 breaks DANKOGAI/Attribute-Util-1.06.tar.gz
Attribute::Method is relying on a B::Deparse bug to accomplish its work. What it is doing is a bit hacky, and has never worked properly with fully-qualified variables named $Foo::self or lexical variables outside the subroutine. Attached is a patch that adds another hack to make it work just as well in 5.16, but still with the same problems it has always had. This new hack is fragile, and may need to be changed for each major Perl version.
Subject: open_dUYvDbfA.txt
diff -Nurp Attribute-Util-1.06-iYcn99-orig/lib/Attribute/Method.pm Attribute-Util-1.06-iYcn99/lib/Attribute/Method.pm --- Attribute-Util-1.06-iYcn99-orig/lib/Attribute/Method.pm 2009-05-27 04:36:08.000000000 -0700 +++ Attribute-Util-1.06-iYcn99/lib/Attribute/Method.pm 2012-01-24 21:54:26.000000000 -0800 @@ -7,7 +7,8 @@ use B::Deparse; our $VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /(\d+)/g; -my $dp = B::Deparse->new('-l'); +my $dp = Attribute::Method::_Deparse->new('-l'); +my $dppack; my %sigil2ref = ( '$' => \undef, '@' => [], @@ -27,6 +28,7 @@ sub import { sub UNIVERSAL::Method : ATTR(RAWDATA) { my ( $pkg, $sym, $ref, undef, $args ) = @_; + $dppack = $pkg; my $src = $dp->coderef2text($ref); if ($args) { $src =~ s/\{/{\nmy \$self = shift; my ($args) = \@_;\n/; @@ -39,6 +41,18 @@ sub UNIVERSAL::Method : ATTR(RAWDATA) { eval qq{ package $pkg; sub $sub_name $src }; } +package + Attribute::Method::_Deparse; + +BEGIN { our @ISA = 'B::Deparse' } + +sub maybe_qualify { + my $ret = SUPER::maybe_qualify{@_}; + my ($pack,$name) = $ret =~ /(.*)::(.+)/; + length $pack && $pack eq $dppack and return $name; + $ret; +} + "Rosebud"; # for MARCEL's sake, not 1 -- dankogai __END__
Thanks, applied. Dan the Maintainer Thereof On Wed Jan 25 00:57:44 2012, SPROUT wrote: Show quoted text
> Attribute::Method is relying on a B::Deparse bug to accomplish its > work. > > What it is doing is a bit hacky, and has never worked properly with > fully-qualified variables > named $Foo::self or lexical variables outside the subroutine. > > Attached is a patch that adds another hack to make it work just as > well in 5.16, but still with the > same problems it has always had. > > This new hack is fragile, and may need to be changed for each major > Perl version.