NAME

CPAN::Mini::Visit::Simple::Auxiliary - Helper functions for CPAN::Mini::Visit::Simple

SYNOPSIS

use CPAN::Mini::Visit::Simple::Auxiliary qw(
    $ARCHIVE_REGEX
    dedupe_superseded
    get_lookup_table
    normalize_version_number
);

DESCRIPTION

This package provides subroutines, exported on demand only, which are used in Perl extension CPAN-Mini-Visit-Simple and its test suite.

SUBROUTINES

dedupe_superseded()

  • Purpose

    Due to what is probably a bug in CPAN::Mini, a minicpan repository may, under its author/id/ directory, contain two or more versions of a single CPAN distribution. Example:

    minicpan/authors/id/D/DR/DROLSKY/Class-MOP-0.82.tar.gz
    minicpan/authors/id/D/DR/DROLSKY/Class-MOP-0.88.tar.gz
    minicpan/authors/id/D/DR/DROLSKY/Class-MOP-0.98.tar.gz

    This may be due to an algorithm which searches for the most recent version of each Perl module on CPAN and then places the distribution in which it is found in the minicpan -- even if that module is not found in the most recent version of the distribution.

    Be this as it may, if you are using a minicpan, chances are that you really want only the most recent version of a particular CPAN distribution and that you don't care about packages found in older versions which have been deleted by the author/maintainer (presumably for good reason) from the newest version.

    So when you traverse a minicpan to compose a list of distributions, you probably want that list deduplicated by stripping out older, presumably superseded versions of distributions. This function tries to accomplish that. It does not try to be omniscient. In particular, it does not strip out distributions with letters in their versions. So, faced with a situation like this:

    minicpan/authors/id/D/DR/DROLSKY/Class-MOP-0.82.tar.gz
    minicpan/authors/id/D/DR/DROLSKY/Class-MOP-0.88.tar.gz
    minicpan/authors/id/D/DR/DROLSKY/Class-MOP-0.98.tar.gz
    minicpan/authors/id/D/DR/DROLSKY/Class-MOP-0.98b.tar.gz

    ... it will dedupe this listing to:

    minicpan/authors/id/D/DR/DROLSKY/Class-MOP-0.98.tar.gz
    minicpan/authors/id/D/DR/DROLSKY/Class-MOP-0.98b.tar.gz
  • Arguments

    $newlist_ref = dedupe_superseded(\@list);

    One argument: Reference to an array holding a list of distributions needing to be duplicated.

  • Return Value

    Reference to an array holding a deduplicated list.

get_lookup_table()

  • Purpose

    Convert a list of distributions into a hash keyed on the stem of the distribution name and having values which are corresponding version numbers.

  • Arguments

    my $primary = get_lookup_table( $self->get_list_ref() );

    Array reference.

  • Return Value

    Reference to hash holding lookup table. Elements in that hash will resemble:

    '/home/user/minicpan/author/id/Alpha-Beta' => {
        version     => '0.01',
        distro      => '/home/user/minicpan/author/id/Alpha-Beta.tar.gz',
    },

normalize_version_number()

  • Purpose

    Yet another attempt to deal with version number madness. No attempt to claim that this is the absolutely correct way to create comparable version numbers.

  • Arguments

    $new_version = normalize_version_number($old_version),

    One argument: Version number, hopefully in two or more decimal-point-delimited parts.

  • Return Value

    A version number in which 'minor version', 'patch version', etc., have been changed to 0-padded 5-digit numbers.

BUGS

Report bugs at https://rt.cpan.org/Public/Bug/Report.html?Queue=CPAN-Mini-Visit-Simple.

AUTHOR

James E Keenan
CPAN ID: jkeenan
Perl Seminar NY
jkeenan@cpan.org
http://thenceforward.net/perl/modules/CPAN-Mini-Visit-Simple/

COPYRIGHT

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

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

CPAN-Mini. CPAN-Mini-Visit-Simple.