Skip Menu |

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

Report information
The Basics
Id: 53420
Status: resolved
Priority: 0/
Queue: Sub-Attribute

People
Owner: Nobody in particular
Requestors: warp [...] spin.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.02
Fixed in: (no value)



Subject: Perl 5.8 compatibility
attributes.pm in Perl 5.8 before Perl 5.8.9 has a bug where it will also send Perl's own attributes (lvalue, method etc.) to a defined MODIFY_CODE_ATTRIBUTES method and croak, if the MODIFY_CODE_ATTRIBUTES methods does not pretend that it handled them.

Therefore, using Perl's attributes will break on perl 5.8 if Sub::Attribute is loaded. The problem can of course easily be fixed by creating an own MODIFY_CODE_ATTRIBUTES which wrap's Sub::Attributes method and filter's Perl's attributes from the list of attributes it should handle, but if you do not want others to stumble across the same problem, Sub::Attribute should probably itself pretend, that it handled method/lvalue/locked/unique/shared by not returning them, in case Perl sends them.

Just for clarity, here's a Perl source snippet on what I do to restore 5.8 compatiblity with Sub::Attribute:

my %builtin = qw(lvalue 1 method 1 locked 1 unique 1 shared 1);
my $old_modify = \&Sub::Attribute::MODIFY_CODE_ATTRIBUTES;
 
sub MODIFY_CODE_ATTRIBUTES {
    my ($pkg, $sub, @attrs ) = @_;
    @attrs = grep { !exists $builtin{$_}} @attrs; # work around bugs in perl < 5.8.9
    my @tmp;
    @tmp = $old_modify->($pkg, $sub, @attrs) if @attrs;
    @tmp;
}

 
Hi, I have fixed the bug you reported, but I cannot have reproduced it (I have only 5.10.0, 5.10.1, 5.8.1, and 5.6.2). Please test the newer version of Sub::Attribute. Regards, -- Goro Fuji (gfx) GFUJI at CPAN.org
Subject: Re: [rt.cpan.org #53420] Perl 5.8 compatibility
Date: Sun, 10 Jan 2010 09:51:30 +0100
To: bug-Sub-Attribute [...] rt.cpan.org
From: Markus Peter <warp [...] spin.de>
On 10.01.2010, at 07:37, Goro Fuji via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=53420 > > > Hi, > > I have fixed the bug you reported, but I cannot have > reproduced it (I have only 5.10.0, 5.10.1, 5.8.1, and 5.6.2). > Please test the newer version of Sub::Attribute.
Hello At the moment it won't even compile on my Perl 5.8.8 system: Attribute.xs: In function 'my_qerror': Attribute.xs:13: error: 'dVAR' undeclared (first use in this function) Attribute.xs:13: error: (Each undeclared identifier is reported only once Attribute.xs:13: error: for each function it appears in.) Attribute.xs:19: warning: implicit declaration of function 'SVfARG' Attribute.xs: In function 'apply_handler': Attribute.xs:75: warning: implicit declaration of function 'mPUSHs' Attribute.xs: In function 'XS_Sub__Attribute_MODIFY_CODE_ATTRIBUTES': Attribute.xs:217: warning: implicit declaration of function 'SvREFCNT_inc_simple_NN' Attribute.xs:217: warning: passing argument 4 of 'Perl_av_store' makes pointer from integer without a cast Attribute.xs:218: warning: passing argument 4 of 'Perl_av_store' makes pointer from integer without a cast make: *** [Attribute.o] Error 1 It seems dVAR is missing from the auto-generated ppport which, on perl 5.8, is generated for perl 5.8, so of course 5.9/5.10 macros are missing. You probably should simply deliver your perl 5.10 ppport.h with it instead of writing it on-demand. -- Markus Peter - warp@spin.de - http://www.spin-ag.de/ - http://www.spin.de/ SPiN AG, Bischof-von-Henle-Str. 2b, 93051 Regensburg, HRB 6295 Regensburg Aufsichtsratsvors.: Dr. Christian Kirnberger, Vorstände: F. Rott, P. Schmid
Subject: Re: [rt.cpan.org #53420] Perl 5.8 compatibility
Date: Mon, 11 Jan 2010 15:04:01 +0900
To: bug-Sub-Attribute [...] rt.cpan.org
From: Goro Fuji <gfuji [...] cpan.org>
Show quoted text
> At the moment it won't even compile on my Perl 5.8.8 system:
Oh, I guess you don't have the latest Devel::PPPort. Did Makefile.PL complain you something like "Warning: prerequisite Devel::PPPort 3.19 not found. We have xxx" ? -- Goro Fuji (gfx)
Subject: Re: [rt.cpan.org #53420] Perl 5.8 compatibility
Date: Mon, 11 Jan 2010 11:52:54 +0100
To: bug-Sub-Attribute [...] rt.cpan.org
From: Markus Peter <warp [...] spin.de>
On 11.01.2010, at 07:04, Goro Fuji via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=53420 > >
>> At the moment it won't even compile on my Perl 5.8.8 system:
> > Oh, I guess you don't have the latest Devel::PPPort. Did Makefile.PL > complain you something like "Warning: prerequisite Devel::PPPort 3.19 > not found. We have xxx" ?
Yes, it did complain and CPAN.pm then auto-installed it. That was the problem probably: Somehow, after the auto-installation, it still used the old Devel::PPPort. I had to manually run perl Makefile.PL again to get the proper ppport.h, then it worked. As the auto-installation stuff usually works great, I simply did not expect this. Anyway, the bug with lvalue etc. is fixed now, thanks! -- Markus Peter - warp@spin.de - http://www.spin-ag.de/ - http://www.spin.de/ SPiN AG, Bischof-von-Henle-Str. 2b, 93051 Regensburg, HRB 6295 Regensburg Aufsichtsratsvors.: Dr. Christian Kirnberger, Vorstände: F. Rott, P. Schmid
You are welcome! -- Goro Fuji (gfx) GFUJI at CPAN.org