Parse::CPAN::Packages - Parse 02packages.details.txt.gz
use Parse::CPAN::Packages; # must have downloaded my $p = Parse::CPAN::Packages->new("02packages.details.txt.gz"); # either a filename as above or pass in the contents of the file # (uncompressed) my $p = Parse::CPAN::Packages->new($packages_details_contents); my $m = $p->package("Acme::Colour"); # $m is a Parse::CPAN::Packages::Package object print $m->package, "\n"; # Acme::Colour print $m->version, "\n"; # 1.00 my $d = $p->distribution; # $d is a Parse::CPAN::Packages::Distribution object print $d->prefix, "\n"; # L/LB/LBROCARD/Acme-Colour-1.00.tar.gz print $d->dist, "\n"; # Acme-Colour print $d->version, "\n"; # 1.00 print $d->maturity, "\n"; # released print $d->filename, "\n"; # Acme-Colour-1.00.tar.gz print $d->cpanid, "\n"; # LBROCARD print $d->distvname, "\n"; # Acme-Colour-1.00 # all the package objects my @packages = $p->packages; # all the distribution objects my @distributions = $p->distributions; # the latest distribution $d = $p->latest_distribution("Acme-Colour"); is($d->prefix, "L/LB/LBROCARD/Acme-Colour-1.00.tar.gz"); is($d->version, "1.00"); # all the latest distributions my @distributions = $p->latest_distributions;
The Comprehensive Perl Archive Network (CPAN) is a very useful collection of Perl code. It has several indices of the files that it hosts, including a file named "02packages.details.txt.gz" in the "modules" directory. This file contains lots of useful information and this module provides a simple interface to the data contained within.
Note that this module does not concern itself with downloading this file. You should do this yourself.
The constructor takes the path to the 02packages.details.txt.gz file. It defaults to loading the file from the current directory.
In a future release Parse::CPAN::Packages::Package and Parse::CPAN::Packages::Distribution might have more information.
Leon Brocard <acme@astray.com>
Copyright (C) 2004, Leon Brocard
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
To install Parse::CPAN::Packages, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::CPAN::Packages
CPAN shell
perl -MCPAN -e shell install Parse::CPAN::Packages
For more information on module installation, please visit the detailed CPAN module installation guide.