| CPAN-Mini-Visit-Simple documentation | view source | Contained in the CPAN-Mini-Visit-Simple distribution. |
CPAN::Mini::Visit::Simple::Auxiliary - Helper functions for CPAN::Mini::Visit::Simple
use CPAN::Mini::Visit::Simple::Auxiliary qw(
$ARCHIVE_REGEX
dedupe_superseded
get_lookup_table
normalize_version_number
);
This package provides subroutines, exported on demand only, which are used in Perl extension CPAN-Mini-Visit-Simple and its test suite.
dedupe_superseded()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
$newlist_ref = dedupe_superseded(\@list);
One argument: Reference to an array holding a list of distributions needing to be duplicated.
Reference to an array holding a deduplicated list.
get_lookup_table()Convert a list of distributions into a hash keyed on the stem of the distribution name and having values which are corresponding version numbers.
my $primary = get_lookup_table( $self->get_list_ref() );
Array reference.
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()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.
$new_version = normalize_version_number($old_version),
One argument: Version number, hopefully in two or more decimal-point-delimited parts.
A version number in which 'minor version', 'patch version', etc., have been
changed to 0-padded 5-digit numbers.
Report bugs at https://rt.cpan.org/Public/Bug/Report.html?Queue=CPAN-Mini-Visit-Simple.
James E Keenan
CPAN ID: jkeenan
Perl Seminar NY
jkeenan@cpan.org
http://thenceforward.net/perl/modules/CPAN-Mini-Visit-Simple/
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.
CPAN-Mini. CPAN-Mini-Visit-Simple.
| CPAN-Mini-Visit-Simple documentation | view source | Contained in the CPAN-Mini-Visit-Simple distribution. |