http://qs1969.pair.com?node_id=81479


in reply to (tye)Re: overload and XS
in thread overload and XS

This module is a bridge between C code and Perl code (similar to Inline), the 'value' above is a C pointer to the structure that is tied, that I want to be able to stringify. 'xml_attribute_stash' is the Perl wrapper package for that particular class, which has 'use overload' with '""' and 'fallback' specified.

I found that I needed to use SvAMAGIC_on to enable overload on that tied C-structure so that the wrapper would see it as overloaded, but 'fallback' still isn't enabled. I'm guessing there's deeper magic to turn on fallback, since the perl wrapper isn't.

Replies are listed 'Best First'.
(tye)Re2: overload and XS
by tye (Sage) on May 18, 2001 at 23:43 UTC

    What I am saying is: Move all of that code out of the C part of the module/XS. Have the C part just return the 'value' as an IV or UV in an orinary Perl scalar and do all of the hash creation, taking of references, tieing, overloading, and magic in Perl code.

            - tye (but my friends call me "Tye")