NAME
    Gentoo::PerlMod::Version - Convert arbitrary Perl Modules' versions into
    normalised Gentoo versions.

VERSION
    version 0.001.000

SYNOPSIS
        use Gentoo::PerlMod::Version qw( :all );

        # http://search.cpan.org/~gmpassos/XML-Smart-1.6.9/
        say gentooize_version( '1.6.9' )  # 1.006.009

        http://search.cpan.org/~pip/Math-BaseCnv-1.6.A6FGHKE/

        say gentooize('1.6.A6FGHKE')   #  <-- death, this is awful

        # -- Work-In-Progress Features --

        say gentooize('1.6.A6FGHKE',{ lax => 1}) # <-- still death

        say gentooize('1.6.A6FGHKE',{ lax => 2}) # 1.006.366.556.632.014  # <-- the best we can do.

        say gentooize('1.9902-TRIAL')   #  <-- death, this is awful

        say gentooize('1.9902-TRIAL', { lax => 1 })   #  1.990.200_rc # <-- -TRIAL gets nuked, 'rc' is added.

METHODS
  gentooize_version
        my $normalized = gentooize_version( $weird_version )

    gentooize_version tries hard to mangle a version that is part of a CPAN
    dist into a normalized form for Gentoo, which can be used as the version
    number of the ebuild, while storing the original upstream version in the
    ebuild.

        CPAN: Foo-Bar-Baz 1.5
        print gentooize_version('1.5');  # -> 1.500
        -> dev-perl/Foo-Bar-Baz-1.500.ebuild
        cat dev-perl/Foo-Bar-Baz-1.500.ebuild
        # ...
        # MODULE_VERSION="1.5"
        # ...

    Normal behaviour accepts only sane non-testing versions, and expands
    them to the form of \d(.\d\d\d)+ i.e.:

        0.1         -> 0.100
        0.001       -> 0.001
        1.1         -> 1.100
        1.123.13    -> 1.123.013

    Etc.

    This uses "version.pm" to read versions and to normalize them to
    floating-point form, and the floating point form is sliced into
    arbitrary parts 3-digits long. i.e.:

        $x = version->parse( 0.01 )->numify;   # 0.010
        $x =~ s/(\.\d\d\d)(\d+)$/$1.$2/;       # 0.010
        $x = version->parse( 0.001 )->numify;  # 0.001
        $x =~ s/(\.\d\d\d)(\d+)$/$1.$2/;       # 0.001
        $x = version->parse( 0.0001 )->numify; # 0.000100
        $x =~ s/(\.\d\d\d)(\d+)$/$1.$2/;       # 0.000.100

    So assuming Perl can handle your versions, they can be normalised.

   lax level 1
        my $nomralized = gentooize_version( $werid_version, { lax => 1 } );

    EXPERIMENTAL: This feature is still in flux, and the emitted versions
    may change.

    This adds one layer of laxativity, and permits parsing and processing of
    "Developer Release" builds.

        1.10-TRIAL  # 1.100_rc
        1.11-TRIAL  # 1.110_rc
        1.1_1       # 1.110_rc

   lax level 2
        my $nomralized = gentooize_version( $werid_version, { lax => 2 } );

    EXPERIMENTAL: This feature is still in flux, and the emitted versions
    may change.

    This adds another layer of laxativity, and permits parsing and
    processing of packages with versions not officially supported by Perl.

    This means versions such as

        1.6.A       # 1.006.010
        1.6.AA      # 1.006.370
        1.6.AAA      # 1.006.370.010
        1.6.AAAA      # 1.006.370.370

        1.6.A6FGHKE # 1.006.366.556.632.014

    This is performed by some really nasty tricks, and treats the ASCII
    portion like a set of pairs.

        1.6.A6.FG.HK.E

    And each ascii pair is treated like a Base36 number.

        0 -> 0
        ....
        9 -> 9
        A -> 10
        ...
        Z -> 35

    A6 is thus

        10 * 36 + 6 => 366

    As you can see, its really nasty, and hopefully its not needed.

AUTHOR
    Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2011 by Kent Fredric <kentnl@cpan.org>.

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

