Michael G Schwern via RT wrote:
Show quoted text> $foo+0 is the simple convention for forcing numeric context.
> Unfortunately...
>
> $ perl -wle 'use version; print qv(1.2.3)+0'
> operation not supported with version object at -e line 1.
That was a conscious choice. What does this mean?
qv(1.2.3)+1;
I chose not to support any mathematical operations on base version.pm objects
because there is no easily explainable mode of operation at hand.
Show quoted text> Rather than having to do special case detection for version objects
> before trying to numify, it would be nice if adding 0 was allowed to
> mean ->numify.
The problem is that I think you are using the wrong tool. ->numify is an
internal method to produce an equivalent value that can be used for comparison,
but it is not the same _thing_ as the underlying object.
As I just said on the Module::Build list, stringification preserves the author's
/intent/, rather than enforcing some specific interpretation of that intent.
This will always work:
$VERSION = qv(1.2.3);
...later...
print "$VERSION";
in that it will return what the author typed. Use version.pm objects for
version comparisons, but if you have to, use the stringified representation for
output purposes...
John