develooper Front page | perl.perl5.porters | Postings from February 2012

Marking a XSUB as lvalue

Thread Next
Father Chrysostomos
February 26, 2012 17:15
Marking a XSUB as lvalue
Message ID:
David Mertens wrote:
> On way to get rid of this issue, as far as I can tell, is to properly
> declare a few XSUBS as lvalue functions. (Right now they are improperly
> declared as such, if I read the above ticket correctly.) However, judging
> from this thread (
> it looks like Perl does not support marking an XSUB as an lvalue sub. Is
> this correct? In particular, is there any way to do this that will stretch
> back to Perl 5.8, which is the version of Perl that PDL currently supports?

You should be able to use to apply the attribute to an
existing XSUB in any Perl version.

> A simple solution, I hope, would be to mark the subs as lvalue before
> calling Dynaloader. Would that work?

That would work, too.


In CHM/PDL-2.4.10.tar.gz on CPAN, in the file Basic/Core/, on line 2240, I see this:

sub PDL::nslice {

And then the lvalue attribute is applied afterwards in Basic/  I don’t see an XS nslice anywhere.  To solve that, apply the attribute before defining the perl function, either via ‘sub nslice:lvalue’ or ‘use attributes __PACKAGE__, \&nslice, "lvalue"’.

Which one of us is confused? Both?

Alternatively, you could persuade Ricardo Signes that it is OK for to turn on :lvalue on already-defined Perl subs, and I’ll back out the change, adding appropriate caveats to the docs.

I’m just uncertain what to do, due to lack of feedback.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About