```{index} single: declare; version function ``` ```{index} single: version::declare; Perl function ``` # declare Build a version object, forcing dotted-integer form regardless of input shape. ## Synopsis ```perl 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`. ## What you get back A blessed `version` object with the `qv` flag set, so stringification produces `v1.2.3` rather than a decimal number. ## Examples The canonical `$VERSION` idiom: ```perl use version; our $VERSION = version->declare("v1.2.3"); print $VERSION; # v1.2.3 ``` `qv` is the same thing, shorter: ```perl use version; my $v = qv("1.2"); print $v->normal; # v1.2.0 ``` A decimal argument is reinterpreted as dotted-integer: ```perl my $v = version->declare("1.2"); print $v->normal; # v1.2.0 — not 1.200 ``` ## Edge cases - Called with no argument — produces `v0.0.0`. - A trailing underscore still sets the `alpha` flag, but the object remains in dotted-integer form. ## Differences from upstream Fully compatible with upstream version {{ upstream.version }}. ## See also - `new` — parse a version string in whatever form it happens to be - `qv` — shorter spelling of `declare` - `normal` — dotted-integer form of an existing object - `is_qv` — test whether an object is in dotted-integer form