This queue is for tickets about the Class-XSAccessor CPAN distribution.

Report information
The Basics
Id:
85167
Status:
open
Priority:
Low/Low

People
Owner:
Nobody in particular
Requestors:
YKO [...] cpan.org
Cc:
ribasushi [...] leporine.io
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: accessor behaves as lvalue_accessor on perl 5.16.1 -Dusethreads
On v5.16.1 built for i686-linux-thread-multi perl -E 'use Class::XSAccessor constructor => "new", accessors => {foo => "foo"}; my $obj = main->new; $obj->foo(1); $obj->foo = 42; say $obj->foo' # 42 On v5.14.2 built for i686-linux-gnu-thread-multi-64int the same cde behaves as expected: # Can't modify non-lvalue subroutine call at -e line 1. $? == 255 I'm not sure I can track what causes the problem, but possible fix I can see atm: Add the following check in *_init functions before CXAH_OPTIMIZE_ENTERSUB(...) call: if (PL_op->op_flags & OPf_MOD || LVRET) DIE(aTHX_ "Can't modify non-lvalue subroutine call"); I'm not sure if -Dusethreads affects anything or it's just 5.16.1 issue.
This is a bug in perl itself: https://rt.perl.org/rt3/Public/Bug/Display.html?id=117947 This bug affects 5.16.1 up to 5.17.11 Despite the fact this is a perl bug, it may still worth to detect lvalue call in _init and throw an axception for affected versions of perl On Thu May 09 17:30:33 2013, YKO wrote:
Show quoted text
> On v5.16.1 built for i686-linux-thread-multi > perl -E 'use Class::XSAccessor constructor => "new", accessors => {foo > => "foo"}; my $obj = main->new; $obj->foo(1); $obj->foo = 42; say > $obj->foo' > # 42 > > On v5.14.2 built for i686-linux-gnu-thread-multi-64int the same cde > behaves as expected: > # Can't modify non-lvalue subroutine call at -e line 1. > $? == 255 > > I'm not sure I can track what causes the problem, but possible fix I > can see atm: > Add the following check in *_init functions before > CXAH_OPTIMIZE_ENTERSUB(...) call: > > if (PL_op->op_flags & OPf_MOD || LVRET) > DIE(aTHX_ "Can't modify non-lvalue subroutine call"); > > I'm not sure if -Dusethreads affects anything or it's just 5.16.1 > issue.
Just encountered this issue at work, and a fix would be quite nice. :)


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.