Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^5: How Critical is Critic?

by hv (Prior)
on May 29, 2023 at 23:26 UTC ( [id://11152487]=note: print w/replies, xml ) Need Help??


in reply to Re^4: How Critical is Critic?
in thread How Critical is Critic?

% perl -wle ' our $VERSION = "0.1_1"; $VERSION = eval $VERSION; if ($VERSION > 0.1 && $VERSION < 0.2) { print "ok"; } else { print "not ok"; } ' ok % perl -wle ' our $VERSION = "0.1_1"; $VERSION = eval { $VERSION }; if ($VERSION > 0.1 && $VERSION < 0.2) { print "ok"; } else { print "not ok"; } ' Argument "0.1_1" isn't numeric in numeric gt (>) at -e line 4. not ok %

eval STRING and eval BLOCK do different things. In this case the BLOCK form is effectively a no-op, so the string is numified using standard coercion during the comparison, and yields the value 0.1 (plus a warning). The string form means "take this string and interpret it as a program" - and Perl code lets us put underscores in numbers, even though the standard coercion rejects them, so it evaluates as the value 0.11.

I don't know about the version->parse variant, but I imagine that PAUSE would not find a version number to parse, so the module would not be indexed correctly.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-16 16:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found