Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Accessors in xs

by BrowserUk (Patriarch)
on Oct 24, 2005 at 18:05 UTC ( [id://502537]=note: print w/replies, xml ) Need Help??


in reply to Accessors in xs

No XS-pert here either, but it looks to me like you are returning an AV*, ie. a ref to an array, rather than a list. You don't show the test code, but if you're doing

my( $x, $y ) = $obj->world_location;

That could be your problem?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Accessors in xs
by hardburn (Abbot) on Oct 24, 2005 at 19:04 UTC

    That was it. Applying chromatic's suggestion for a *PUSH* macro fixed it all:

    void world_location(self) SV* self PREINIT: HV *hash_self = (HV*) SvRV( self ); SV **x = hv_fetch( hash_self, "x", 1, FALSE ); SV **y = hv_fetch( hash_self, "y", 1, FALSE ); PPCODE: EXTEND(SP, 2); PUSHs( *x ); PUSHs( *y );

    Passes all tests. Thanks.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://502537]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-03-29 07:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found