Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Dualvars besides $!

by ikegami (Patriarch)
on Jan 27, 2014 at 19:54 UTC ( [id://1072268]=note: print w/replies, xml ) Need Help??


in reply to Dualvars besides $!

This post is wrong.


Whether the docs are correct or not depends on the version of Perl.

perl -MDevel::Peek -e'$!=1; print("$!\n"); Dump($!);'

5.8.9:

... FLAGS = (GMG,SMG,pNOK,pPOK) ...

No public values. Not a dualvar.

5.18.1:

... FLAGS = (GMG,SMG,NOK,POK,pNOK,pPOK) ...

Two public values (NOK = has NV = has floating point number, POK = has PV = has string). Dualvar.

Replies are listed 'Best First'.
Re^2: Dualvars besides $!
by ikegami (Patriarch) on Jan 27, 2014 at 20:01 UTC

    The latest Scalar::Util::isdual considers FLAGS = (GMG,SMG,pNOK,pPOK) to be a dualvar. (No idea about earlier versions, but I suspect it's the same.) The docs are wrong. The following returns 1 for both 5.8.9 and 5.18.1, while the docs say it returns false:

    perl -MScalar::Util=isdual -MDevel::Peek \ -e'$!=1; print("$!\n"); print(isdual($!)?1:0,"\n"); Dump($!);'

    Nit: $! is magical (like tied variables), but it's not a tied variable like the docs say.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-04-23 19:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found