Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: updating hash from perl -> xsub

by borisz (Canon)
on May 21, 2006 at 09:57 UTC ( [id://550768]=note: print w/replies, xml ) Need Help??


in reply to updating hash from perl -> xsub

Here is my frist try:
It should work for all simple cases like '1234', 121, 12111.0
use Inline 'C'; use Devel::Peek; my $x; my $v = 2147483648; Dump($v); $x->{T}{z} = force_iv($v); Dump($x->{T}{z}); __END__ __C__ SV* force_iv(SV*v){ return SvNOK(v) ? newSVuv(SvNV(v)) : newSVuv(SvIV(v)); }
Boris

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-25 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found