Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: (tye)Re: How to make bi-modal variables like $! ?

by bikeNomad (Priest)
on Jun 28, 2001 at 20:45 UTC ( #92365=note: print w/replies, xml ) Need Help??


in reply to (tye)Re: How to make bi-modal variables like $! ?
in thread How to make bi-modal variables like $! ?

Cool! Re-writing the guts of SetDualVar using Inline, it looks like:

#!/usr/bin/perl -w # Solution by Kenneth Albanowski <kjahds@kjahds.com> # from the module SetDualVar-1.0.tar.gz # re-written using Inline. use strict; use Inline 'C'; my $v; set_both($v, "I'm a string too!", 123); print $v+0, " $v\n"; __END__ __C__ void set_both(SV* variable, SV* string, SV* numeric) { SvPV(string, PL_na); if(!SvPOKp(string) || (!SvNOKp(numeric) && !SvIOKp(numeric)) ) { croak("Usage: set_both variable,string,numeric"); } sv_setsv(variable,string); if(SvNOKp(numeric)) { sv_setnv(variable,SvNV(numeric)); } else { sv_setiv(variable,SvIV(numeric)); } SvPOK_on(variable); }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://92365]
help
Chatterbox?
[dazz]: At present, I am saving the Image::Grab image to disk, then creating a new Image::Magick object that reads the disk file.
[dazz]: .
[choroba]: Discipulus Sounds interesting. Any pictures of the puppets or paintings?
[Corion]: Oof - "Anyway, if it is not obvious, please keep this discussion entirely confidential for now.", as seen on a public mailing list ;)

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2017-03-27 07:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (317 votes). Check out past polls.