develooper Front page | perl.perl5.porters | Postings from October 2011

[perl #72708] [PATCH] TODO test for AUTOLOAD XSUB and inheritance

Thread Previous | Thread Next
Father Chrysostomos via RT
October 11, 2011 09:44
[perl #72708] [PATCH] TODO test for AUTOLOAD XSUB and inheritance
Message ID:
On Tue Oct 11 09:22:59 2011, sprout wrote:
> On Oct 11, 2011, at 9:10 AM, Father Chrysostomos wrote:
> >
> > On Oct 11, 2011, at 9:03 AM, Steffen Mueller wrote:
> >
> >> This is regarding Father Chrysostomos' changes to fix the current
>    behaviour of XS AUTOLOAD methods, specifically commits
>    8fa6a40953ef88573ed3cbbb37666e7b72dec7dd and the tests in
>    6911735f50121ad015d280f86e257e8e9eae797a.
> >>
> >> My network connection is too slow/bad/mobile to searching for the
>    bug, but I know there's a perlbug that I filed about AUTOLOAD
>    methods implemented in XS.
> >> In a nutshell, because Doug's hack prevents $AUTOLOAD from being
>    set at all, the XS AUTOLOAD cannot be inherited/reused. The SvPVX
>    of the CV only contains the method name, not the class, so it's not
>    sufficient for figuring out for which class the AUTOLOAD was
>    invoked.
> >
> > It’s not documented, but you can use CvSTASH.
> In view of that use of CvSTASH, is it necessary to set $AUTOLOAD?
>    Regardless of whether it is necessary, is it desirable? :-)

I’ve just discovered bug #6828, according to which $AUTOLOAD *was*
populated in 5.6.0, but not in 5.6.1.

A diff between the two shows this in gv_autoload4:

+    if (!CvROOT(cv))
+	return Nullgv;

Back then, CvROOT and CvXSUB were two separate fields in the struct, so
that meant XS autoloading stopped working.

So it was reintroduced in 5.8.0 as a ‘new feature’.

I find that a very compelling reason to reinstate the old behaviour. 
But the new behaviour has been around long enough we probably have to
keep both.

> >>
> >> I hope my memory didn't fail me, but it'll be some time before I
>    can check for sure.
> >>
> >> This bug in conjunction with the general badness of the SvPVX(CV)
>    abuse makes me think that unless a CPAN grep turns up many
>    examples, it may be worth breaking the long-standing behaviour. If
>    we don't, does anybody have an idea how to efficiently include the
>    namespace part of $AUTOLOAD?
> >>
> >> Best regards,
> >> Steffen
> >

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