Skip to content

Commit

Permalink
Fix typo in pod example for comparing versions.
Browse files Browse the repository at this point in the history
The example in version.pod for comparing versions line Perl#227 says "FALSE"
but it should be "TRUE" since v.95.0 < v.960.0. But if we fix it to
"TRUE", it does not illustrate the trap very well, so I changed the
wording a little bit.
  • Loading branch information
hakonhagland authored and Leont committed Jul 31, 2020
1 parent fe76e18 commit ef41af2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/version.pod
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ term will be converted to a version object using C<parse()>. This may give
surprising results:

$v1 = version->parse("v0.95.0");
$bool = $v1 < 0.96; # FALSE since 0.96 is v0.960.0
$bool = $v1 < 0.94; # TRUE since 0.94 is v0.940.0

Always comparing to a version object will help avoid surprises:

$bool = $v1 < version->parse("v0.96.0"); # TRUE
$bool = $v1 < version->parse("v0.94.0"); # FALSE

Note that "alpha" version objects (where the version string contains
a trailing underscore segment) compare as less than the equivalent
Expand Down

0 comments on commit ef41af2

Please sign in to comment.