Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Data::Types or grok_number

by tqisjim (Beadle)
on Sep 25, 2012 at 17:57 UTC ( #995606=note: print w/replies, xml ) Need Help??


in reply to Re: Data::Types or grok_number
in thread Data::Types or grok_number

I was thinking of something along the lines of the following:

print TQIS::Primitive::typeis("1") ; > string print TQIS::Primitive::typeis(1) ; > integer
Here is the code:
#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" SV* typeis ( SV* what ) ; SV* typeis ( SV* what ) { if ( SvIOK( what ) ) return newSVpvs( "integer" ) ; else if ( SvNOK( what ) ) return newSVpvs( "double" ) ; else if ( SvPOK( what ) ) return newSVpvs( "string" ) ; return newSVpvs( "unknown" ) ; } MODULE = TQIS::Primitive PACKAGE = TQIS::Primitive PROTOTYPES: ENABLE SV* typeis( what ) SV* what

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995606]
help
Chatterbox?
[Discipulus]: ah! just with my old system perl (5.8.8) was needed
[Corion]: Has anybody toyed around with Mastodon? There is a Perl module for it, but I'm not sure that it's a yak worth chasing
[Corion]: On the upside, maybe running that for my family would be interesting, or at least for myself
[Corion]: I'm not fond of using a server hosted by other people, even if they claim to be GNU ;)
[Discipulus]: gee a social network with the family.. is this a dread? ;=)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2017-05-26 07:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?