The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Validate that a given string can be parsed as a version object, but doesn't actually perform the parsing. Can use either strict or lax validation rules. Can optionally set a number of hint variables to save the parsing code some time when tokenizing.

Returns a pointer to the next character after the parsed version string, as well as upgrading the passed in SV to an RV.

Function must be called with an already existing SV like

    sv = newSV(0);
    s = scan_version(s, SV *sv, bool qv);

Performs some preprocessing to the string to ensure that it has the correct characteristics of a version. Flags the object if it contains an underscore (which denotes this is an alpha version). The boolean qv denotes that the version should be interpreted as if it had multiple decimals, even if it doesn't.

Returns a new version object based on the passed in SV:

    SV *sv = new_version(SV *ver);

Does not alter the passed in ver SV. See "upg_version" if you want to upgrade the SV.

In-place upgrade of the supplied SV to a version object.

    SV *sv = upg_version(SV *sv, bool qv);

Returns a pointer to the upgraded SV. Set the boolean qv if you want to force this SV to be interpreted as an "extended" version.

Validates that the SV contains valid internal structure for a version object. It may be passed either the version object (RV) or the hash itself (HV). If the structure is valid, it returns the HV. If the structure is invalid, it returns NULL.

    SV *hv = vverify(sv);

Note that it only confirms the bare minimum structure (so as not to get confused by derived classes which may contain additional hash entries):

  • The SV is an HV or a reference to an HV

  • The hash contains a "version" key

  • The "version" key has a reference to an AV as its value

Accepts a version object and returns the normalized floating point representation. Call like:

    sv = vnumify(rv);

NOTE: you can pass either the object directly or the SV contained within the RV.

The SV returned has a refcount of 1.

Accepts a version object and returns the normalized string representation. Call like:

    sv = vnormal(rv);

NOTE: you can pass either the object directly or the SV contained within the RV.

The SV returned has a refcount of 1.

In order to maintain maximum compatibility with earlier versions of Perl, this function will return either the floating point notation or the multiple dotted notation, depending on whether the original version contained 1 or more dots, respectively.

The SV returned has a refcount of 1.

Version object aware cmp. Both operands must already have been converted into version objects.