NAME

version::Normal - More normal forms for version objects

VERSION

version 0.1.0

SYNOPSIS

    use version::Normal;

    # 'v0.400'
    version->parse('0.4')->normal2;

    # '0.400.0'
    version->parse('0.4')->normal3;

DESCRIPTION

This is alpha software. The API may change.

This module loads the version module and adds two methods to its objects. Those methods implement normal forms akin to the standard normal() method.

Furthermore, these normal forms have the following property:

    NORMAL(v1) = NORMAL(v2)   if   v1 == v2

Notice that this property does not hold for normal(). For example, for two version numbers like 'v1.0.0' and 'v1.0.0.0' which satisfy

    version->parse('v1.0.0') == version->parse('v1.0.0.0')

the following table of results can be computed

    V                               'v1.0.0'         'v1.0.0.0'

    version->parse(V)->normal()     'v1.0.0'    ≠    'v1.0.0.0'
    version->parse(V)->normal2()    'v1.0'      =    'v1.0'
    version->parse(V)->normal3()    '1.0.0'     =    '1.0.0'

METHODS

version::Normal implements the following methods and installs them into version namespace.

normal2

    $string = $version->normal2(); 

Returns a string with a normalized dotted-decimal form with a leading-v, at least 2 components, and no superfluous trailing 0.

Some examples are:

    V          version->parse(V)->normal2()

    0.1        v0.100
    v0.1       v0.1
    v1         v1.0
    0.010      v1.10
    0.3.10     v0.3.10
    v0.0.0.0   v0.0
    v0.1.0.0   v0.1

This form looks good when describing the version of a software component for humans to read (eg. Changes file, --version output, etc.)

normal3

    $string = $version->normal3(); 

Returns a string with a normalized dotted-decimal form with no leading-v, at least 3 components, and no superfluous trailing 0.

Some examples are:

    V          version->parse(V)->normal2()

    0.1        0.100.0
    v0.1       0.1.0
    v1         1.0.0
    0.010      1.10.0
    0.3.10     0.3.10
    v0.0.0.0   0.0.0
    v0.1.0.0   0.1.0

This form is appropriate for distribution tarball names (like "version-Normal-0.1.0.tar.gz") – only digits and dots and no need for special interpretation of a leading-v.

SEE ALSO

version

ACKNOWLEDGEMENTS

The development of this library has been partially sponsored by Connectivity, Inc.

AUTHOR

Adriano Ferreira <ferreira@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Adriano Ferreira.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.