declare#
Build a version object, forcing dotted-integer form regardless of input shape.
Σύνοψη#
our $VERSION = version->declare("v1.2.3");
our $VERSION = qv("v1.2.3");
declare is the recommended way to set $VERSION to a dotted-integer version. qv is its short-name alias, imported into the caller’s package by use version. Both treat the argument as dotted-integer even when the input looks decimal - declare("1.2") yields v1.2.0, not 1.200.
Τι επιστρέφεται#
A blessed version object with the qv flag set, so stringification produces v1.2.3 rather than a decimal number.
Παραδείγματα#
The canonical $VERSION idiom:
use version;
our $VERSION = version->declare("v1.2.3");
print $VERSION; # v1.2.3
qv is the same thing, shorter:
use version;
my $v = qv("1.2");
print $v->normal; # v1.2.0
A decimal argument is reinterpreted as dotted-integer:
my $v = version->declare("1.2");
print $v->normal; # v1.2.0 - not 1.200
Οριακές περιπτώσεις#
Called with no argument - produces
v0.0.0.A trailing underscore still sets the
alphaflag, but the object remains in dotted-integer form.
Διαφορές από το upstream#
Fully compatible with upstream version 0.9929.
Δείτε επίσης#
new- parse a version string in whatever form it happens to beqv- shorter spelling ofdeclarenormal- dotted-integer form of an existing objectis_qv- test whether an object is in dotted-integer form