r3092 - in /packages/libparse-cpan-packages-perl/trunk: ./ debian/
lib/Parse/CPAN/ lib/Parse/CPAN/Packages/ t/
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Sat Jun 17 16:55:23 UTC 2006
Author: gregoa-guest
Date: Sat Jun 17 16:55:19 2006
New Revision: 3092
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3092
Log:
* New upstream release.
* Set Debhelper Compatibility Level to 5.
* Set Standards-Version to 3.7.2 (no changes).
* Added libversion-perl to Build-Depends-Indep.
Modified:
packages/libparse-cpan-packages-perl/trunk/Build.PL
packages/libparse-cpan-packages-perl/trunk/CHANGES
packages/libparse-cpan-packages-perl/trunk/META.yml
packages/libparse-cpan-packages-perl/trunk/Makefile.PL
packages/libparse-cpan-packages-perl/trunk/README
packages/libparse-cpan-packages-perl/trunk/debian/changelog
packages/libparse-cpan-packages-perl/trunk/debian/compat
packages/libparse-cpan-packages-perl/trunk/debian/control
packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages.pm
packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages/Distribution.pm
packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages/Package.pm
packages/libparse-cpan-packages-perl/trunk/t/simple.t
Modified: packages/libparse-cpan-packages-perl/trunk/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/Build.PL?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/Build.PL (original)
+++ packages/libparse-cpan-packages-perl/trunk/Build.PL Sat Jun 17 16:55:19 2006
@@ -1,18 +1,17 @@
+#!perl
use Module::Build;
use strict;
my $build = Module::Build->new(
- create_makefile_pl => 'traditional',
- license => 'perl',
- module_name => 'Parse::CPAN::Packages',
- requires => {
- 'Class::Accessor::Fast' => 0,
- 'CPAN::DistnameInfo' => 0,
- 'IO::Zlib' => 0,
- 'Sort::Versions' => 0,
- },
- build_requires => {
- 'Test::More' => 0,
- },
+ create_makefile_pl => 'traditional',
+ license => 'perl',
+ module_name => 'Parse::CPAN::Packages',
+ requires => {
+ 'Class::Accessor::Fast' => 0,
+ 'CPAN::DistnameInfo' => 0,
+ 'IO::Zlib' => 0,
+ 'version' => 0,
+ },
+ build_requires => { 'Test::More' => 0, },
);
$build->create_build_script;
Modified: packages/libparse-cpan-packages-perl/trunk/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/CHANGES?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/CHANGES (original)
+++ packages/libparse-cpan-packages-perl/trunk/CHANGES Sat Jun 17 16:55:19 2006
@@ -1,4 +1,9 @@
CHANGES file for Parse::CPAN::Packages
+
+2.26 Wed Jun 14 07:31:26 BST 2006
+ - use version.pm (or number comparison if that fails) instead of
+ Sort::Versions for latest_distribution() (spotted by Thomas Klausner)
+ - run perltidy on the source
2.25 Tue Jul 5 01:16:48 BST 2005
- fix bug where passing in the gz contents was not working
Modified: packages/libparse-cpan-packages-perl/trunk/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/META.yml?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/META.yml (original)
+++ packages/libparse-cpan-packages-perl/trunk/META.yml Sat Jun 17 16:55:19 2006
@@ -1,25 +1,8 @@
----
+--- #YAML:1.0
name: Parse-CPAN-Packages
-version: 2.25
+version: 2.26
author:
- Leon Brocard <acme at astray.com>
abstract: Parse 02packages.details.txt.gz
license: perl
-requires:
- CPAN::DistnameInfo: 0
- Class::Accessor::Fast: 0
- IO::Zlib: 0
- Sort::Versions: 0
-build_requires:
- Test::More: 0
-provides:
- Parse::CPAN::Packages:
- file: lib/Parse/CPAN/Packages.pm
- version: 2.25
- Parse::CPAN::Packages::Distribution:
- file: lib/Parse/CPAN/Packages/Distribution.pm
- version: 2.12
- Parse::CPAN::Packages::Package:
- file: lib/Parse/CPAN/Packages/Package.pm
- version: 2.12
-generated_by: Module::Build version 0.261
+generated_by: Module::Build version 0.2612, without YAML.pm
Modified: packages/libparse-cpan-packages-perl/trunk/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/Makefile.PL?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/Makefile.PL (original)
+++ packages/libparse-cpan-packages-perl/trunk/Makefile.PL Sat Jun 17 16:55:19 2006
@@ -8,8 +8,8 @@
'CPAN::DistnameInfo' => '0',
'Class::Accessor::Fast' => '0',
'IO::Zlib' => '0',
- 'Sort::Versions' => '0',
- 'Test::More' => '0'
+ 'Test::More' => '0',
+ 'version' => '0'
},
'INSTALLDIRS' => 'site',
'PL_FILES' => {}
Modified: packages/libparse-cpan-packages-perl/trunk/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/README?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/README (original)
+++ packages/libparse-cpan-packages-perl/trunk/README Sat Jun 17 16:55:19 2006
@@ -46,14 +46,93 @@
"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.
+
+ Methods
+ new Creates a new instance from a details file.
+
+ The constructor can be passed either the path to the
+ "02packages.details.txt.gz" file, a path to an ungzipped version of
+ this file, or a scalar containing the entire uncompressed contents
+ of the file.
+
+ Note that this module does not concern itself with downloading this
+ file. You should do this yourself. For example:
+
+ use LWP::Simple qw(get);
+ my $data = get("http://www.cpan.org/modules/02packages.details.txt.gz");
+ my $p = Parse::CPAN::Packages->new($data);
+
+ package($packagename)
+ Returns a "Parse::CPAN::Packages::Package" that represents the named
+ package.
+
+ my $p = Parse::CPAN::Distribution->new($gzfilename);
+ my $package = $p->package("Acme::Colour");
+
+ packages()
+ Returns a list of Parse::CPAN::Packages::Package objects
+ representing all the packages that were extracted from the file.
+
+ package_count()
+ Returns the numebr of packages stored.
+
+ distribution($filename)
+ Returns a Parse::CPAN::Distribution that represents the filename
+ passed:
+
+ my $p = Parse::CPAN::Distribution->new($gzfilename);
+ my $dist = $p->distribution('L/LB/LBROCARD/Acme-Colour-1.00.tar.gz');
+
+ distrbutions()
+ Returns a list of Parse::CPAN::Distribution objects representing all
+ the known distributions.
+
+ distribution_count()
+ Returns the number of distributions stored.
+
+ latest_distribution($distname)
+ Returns the "Parse::CPAN::Distribution" that represents the latest
+ distribution for the named disribution passed, that is to say it
+ returns the distribution that has the highest version number (as
+ determined by version.pm or number comparison if that fails):
+
+ my $p = Parse::CPAN::Distribution->new($gzfilename);
+ my $dist = $p->distribution('Acme-Color');
+
+ latest_distrbutions()
+ Returns a list of Parse::CPAN::Distribution objects representing all
+ the latest distributions.
+
+ latest_distribution_count()
+ Returns the number of distributions stored.
+
+ Addtional Methods
+ These are additional methods that you may find useful.
+
+ parse($filename)
+ Parses the filename. Works in a similar fashion to the the
+ constructor (i.e. you can pass it a filename for a
+ compressed/1uncompressed file, a uncompressed scalar containing the
+ file. You can also pass nothing to indicate to load the compressed
+ file from the current working directory.)
+
+ Note that each time this function is run the packages and
+ distribtions found will be "added" to the current list of packages.
+
+ add_quick($package_name, $package_version, $prefix)
+ Quick way of adding a new package and distribution.
+
+ add_package($package_obj)
+ Adds a package. Note that you'll probably want to add the
+ corrisponding distribution for that package too (it's not done
+ automatically.)
+
+ add_distribution($distribution_obj)
+ Adds a distribution. Note that you'll probably want to add the
+ corrisponding packages for that distribution too (it's not done
+ automatically.)
AUTHOR
Leon Brocard <acme at astray.com>
@@ -64,3 +143,19 @@
This module is free software; you can redistribute it or modify it under
the same terms as Perl itself.
+BUGS
+ This module leaks memory as packages hold distributions and
+ distributions hold packages. No attempt has been made to fix this as
+ it's not anticpated that this will be used in long running programs that
+ will dispose of the objects once created.
+
+ The old interface for "new" where if you passed no arguments it would
+ look for a "02packages.details.txt.gz" in your current directory is no
+ longer supported.
+
+TODO
+ delete_* methods. merge_into method. Documentation for other modules.
+
+SEE ALSO
+ CPAN::DistInfoname, Parse::CPAN::Packages::Writer.
+
Modified: packages/libparse-cpan-packages-perl/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/debian/changelog?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/debian/changelog (original)
+++ packages/libparse-cpan-packages-perl/trunk/debian/changelog Sat Jun 17 16:55:19 2006
@@ -1,3 +1,12 @@
+libparse-cpan-packages-perl (2.26-1) unstable; urgency=low
+
+ * New upstream release.
+ * Set Debhelper Compatibility Level to 5.
+ * Set Standards-Version to 3.7.2 (no changes).
+ * Added libversion-perl to Build-Depends-Indep.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at> Sat, 17 Jun 2006 18:52:57 +0200
+
libparse-cpan-packages-perl (2.25-1) unstable; urgency=low
* New upstream release. (Closes: #329652)
Modified: packages/libparse-cpan-packages-perl/trunk/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/debian/compat?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/debian/compat (original)
+++ packages/libparse-cpan-packages-perl/trunk/debian/compat Sat Jun 17 16:55:19 2006
@@ -1,1 +1,1 @@
-4
+5
Modified: packages/libparse-cpan-packages-perl/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/debian/control?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/debian/control (original)
+++ packages/libparse-cpan-packages-perl/trunk/debian/control Sat Jun 17 16:55:19 2006
@@ -2,10 +2,10 @@
Section: perl
Priority: optional
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Florian Ragwitz <florian at mookooh.org>, Joachim Breitner <nomeata at debian.org>, Niko Tyni <ntyni at iki.fi>
-Build-Depends: debhelper (>= 4.0.0)
-Build-Depends-Indep: perl (>= 5.6.0-16), libsort-versions-perl (>= 1.5), libcpan-distnameinfo-perl (>= 0.03), libclass-accessor-perl (>= 0.19), libio-zlib-perl
-Standards-Version: 3.6.2
+Uploaders: Florian Ragwitz <florian at mookooh.org>, Joachim Breitner <nomeata at debian.org>, Niko Tyni <ntyni at iki.fi>, gregor herrmann <gregor+debian at comodo.priv.at>
+Build-Depends: debhelper (>= 5.0.0)
+Build-Depends-Indep: perl (>= 5.6.0-16), libsort-versions-perl (>= 1.5), libcpan-distnameinfo-perl (>= 0.03), libclass-accessor-perl (>= 0.19), libio-zlib-perl, libversion-perl
+Standards-Version: 3.7.2
Package: libparse-cpan-packages-perl
Architecture: all
Modified: packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages.pm?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages.pm (original)
+++ packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages.pm Sat Jun 17 16:55:19 2006
@@ -6,191 +6,204 @@
use Compress::Zlib;
use IO::Zlib;
use Parse::CPAN::Packages::Package;
-use Sort::Versions;
+use version;
use vars qw($VERSION);
-$VERSION = '2.25';
+$VERSION = '2.26';
sub new {
- my $class = shift;
-
- my $self = { data => {}, dists => {}, latestdists => {} };
- bless $self, $class;
-
- # read the file then parse it if present
- $self->parse(shift) if @_;
-
- return $self;
+ my $class = shift;
+
+ my $self = { data => {}, dists => {}, latestdists => {} };
+ bless $self, $class;
+
+ # read the file then parse it if present
+ $self->parse(shift) if @_;
+
+ return $self;
}
# read the file into memory and return it
sub _slurp_details {
- my $self = shift;
- my $filename = (@_) ? shift: "02packages.details.txt.gz";
-
- if ($filename =~ /Description:/) {
- return $filename;
- } elsif ($filename =~ /\.gz/) {
- my $fh = IO::Zlib->new($filename, "rb")
- || die "Failed to read $filename: $!";
- return join '', <$fh>;
- } elsif ($filename =~ /^\037\213/) {
- return Compress::Zlib::memGunzip($filename);
- } else {
- open(IN, $filename) || die "Failed to read $filename: $!";
- return join '', <IN>;
- close(IN);
- }
+ my $self = shift;
+ my $filename = (@_) ? shift: "02packages.details.txt.gz";
+
+ if ( $filename =~ /Description:/ ) {
+ return $filename;
+ } elsif ( $filename =~ /\.gz/ ) {
+ my $fh = IO::Zlib->new( $filename, "rb" )
+ || die "Failed to read $filename: $!";
+ return join '', <$fh>;
+ } elsif ( $filename =~ /^\037\213/ ) {
+ return Compress::Zlib::memGunzip($filename);
+ } else {
+ open( IN, $filename ) || die "Failed to read $filename: $!";
+ return join '', <IN>;
+ close(IN);
+ }
}
sub parse {
- my $self = shift;
- my $details = $self->_slurp_details(shift);
-
- # remove the preamble
- $details = (split "\n\n", $details)[1];
-
- # run though each line of the file
- foreach my $line (split "\n", $details) {
-
- # make a package object from the line
- my ($package_name, $package_version, $prefix) = split ' ', $line;
- $self->add_quick($package_name, $package_version, $prefix);
- }
+ my $self = shift;
+ my $details = $self->_slurp_details(shift);
+
+ # remove the preamble
+ $details = ( split "\n\n", $details )[1];
+
+ # run though each line of the file
+ foreach my $line ( split "\n", $details ) {
+
+ # make a package object from the line
+ my ( $package_name, $package_version, $prefix ) = split ' ', $line;
+ $self->add_quick( $package_name, $package_version, $prefix );
+ }
}
sub add_quick {
- my $self = shift;
- my ($package_name, $package_version, $prefix) = @_;
-
- # create the package object
- my $m = Parse::CPAN::Packages::Package->new;
- $m->package($package_name);
- $m->version($package_version);
-
- # create a distribution object (or get an existing one)
- my $dist = $self->distribution_from_prefix($prefix);
-
- # make the package have the distribion and the distribution
- # have the package. Yes, this creates a cirtular reference. eek!
- $m->distribution($dist);
- $dist->add_package($m);
-
- # record this distribution and package
- $self->add_distribution($dist);
- $self->add_package($m);
+ my $self = shift;
+ my ( $package_name, $package_version, $prefix ) = @_;
+
+ # create the package object
+ my $m = Parse::CPAN::Packages::Package->new;
+ $m->package($package_name);
+ $m->version($package_version);
+
+ # create a distribution object (or get an existing one)
+ my $dist = $self->distribution_from_prefix($prefix);
+
+ # make the package have the distribion and the distribution
+ # have the package. Yes, this creates a cirtular reference. eek!
+ $m->distribution($dist);
+ $dist->add_package($m);
+
+ # record this distribution and package
+ $self->add_distribution($dist);
+ $self->add_package($m);
}
sub distribution_from_prefix {
- my $self = shift;
- my $prefix = shift;
-
- # see if we have one of these already and return it if we do.
- my $d = $self->distribution($prefix);
- return $d if $d;
-
- # create a new one otherwise
- $d = Parse::CPAN::Packages::Distribution->new;
- my $i = CPAN::DistnameInfo->new($prefix);
- $d->prefix($prefix);
- $d->dist($i->dist);
- $d->version($i->version);
- $d->maturity($i->maturity);
- $d->filename($i->filename);
- $d->cpanid($i->cpanid);
- $d->distvname($i->distvname);
- return $d;
+ my $self = shift;
+ my $prefix = shift;
+
+ # see if we have one of these already and return it if we do.
+ my $d = $self->distribution($prefix);
+ return $d if $d;
+
+ # create a new one otherwise
+ $d = Parse::CPAN::Packages::Distribution->new;
+ my $i = CPAN::DistnameInfo->new($prefix);
+ $d->prefix($prefix);
+ $d->dist( $i->dist );
+ $d->version( $i->version );
+ $d->maturity( $i->maturity );
+ $d->filename( $i->filename );
+ $d->cpanid( $i->cpanid );
+ $d->distvname( $i->distvname );
+ return $d;
}
sub add_package {
- my $self = shift;
- my $package = shift;
-
- # store it
- $self->data->{ $package->package } = $package;
-
- return $self;
+ my $self = shift;
+ my $package = shift;
+
+ # store it
+ $self->data->{ $package->package } = $package;
+
+ return $self;
}
sub package {
- my $self = shift;
- my $package_name = shift;
- return $self->data->{$package_name};
+ my $self = shift;
+ my $package_name = shift;
+ return $self->data->{$package_name};
}
sub packages {
- my $self = shift;
- return values %{ $self->data };
+ my $self = shift;
+ return values %{ $self->data };
}
sub add_distribution {
- my $self = shift;
- my $dist = shift;
-
- $self->_store_distribution($dist);
- $self->_ensure_latest_distribution($dist);
+ my $self = shift;
+ my $dist = shift;
+
+ $self->_store_distribution($dist);
+ $self->_ensure_latest_distribution($dist);
}
sub _store_distribution {
- my $self = shift;
- my $dist = shift;
-
- $self->dists->{ $dist->prefix } = $dist;
+ my $self = shift;
+ my $dist = shift;
+
+ $self->dists->{ $dist->prefix } = $dist;
}
sub _ensure_latest_distribution {
- my $self = shift;
- local $a = shift;
- local $b = $self->latest_distribution($a->dist);
- if (!defined($b)
- or versioncmp($a->version || 0, $b->version || 0) > 0)
- {
- $self->_set_latest_distribution($a);
- }
+ my $self = shift;
+ local $a = shift;
+ local $b = $self->latest_distribution( $a->dist );
+ unless ($b) {
+ $self->_set_latest_distribution($a);
+ return;
+ }
+ my ( $av, $bv );
+ eval {
+ $av = version->new( $a->version || 0 );
+ $bv = version->new( $a->version || 0 );
+ };
+ if ( $av && $bv ) {
+ if ( $av > $bv ) {
+ $self->_set_latest_distribution($a);
+ }
+ } else {
+ if ( $a->dist > $b->dist ) {
+ $self->_set_latest_distribution($a);
+ }
+ }
}
sub distribution {
- my $self = shift;
- my $dist = shift;
- return $self->dists->{$dist};
+ my $self = shift;
+ my $dist = shift;
+ return $self->dists->{$dist};
}
sub distributions {
- my $self = shift;
- return values %{ $self->dists };
+ my $self = shift;
+ return values %{ $self->dists };
}
sub _set_latest_distribution {
- my $self = shift;
- my $dist = shift;
- return unless $dist->dist;
- $self->latestdists->{ $dist->dist } = $dist;
+ my $self = shift;
+ my $dist = shift;
+ return unless $dist->dist;
+ $self->latestdists->{ $dist->dist } = $dist;
}
sub latest_distribution {
- my $self = shift;
- my $dist = shift;
- return unless $dist;
- return $self->latestdists->{$dist};
+ my $self = shift;
+ my $dist = shift;
+ return unless $dist;
+ return $self->latestdists->{$dist};
}
sub latest_distributions {
- my $self = shift;
- return values %{ $self->latestdists };
+ my $self = shift;
+ return values %{ $self->latestdists };
}
sub package_count {
- my $self = shift;
- return scalar scalar $self->packages;
+ my $self = shift;
+ return scalar scalar $self->packages;
}
sub distribution_count {
- my $self = shift;
- return scalar $self->distributions;
+ my $self = shift;
+ return scalar $self->distributions;
}
sub latest_distribution_count {
- my $self = shift;
- return scalar $self->latest_distributions;
+ my $self = shift;
+ return scalar $self->latest_distributions;
}
1;
@@ -307,10 +320,10 @@
=item latest_distribution($distname)
-Returns the C<Parse::CPAN::Distribution> that represents the
-latest distribution for the named disribution passed, that is
-to say it returns the distribution that has the highest version
-number (as determined by Sort::Version):
+Returns the C<Parse::CPAN::Distribution> that represents the latest
+distribution for the named disribution passed, that is to say it
+returns the distribution that has the highest version number (as
+determined by version.pm or number comparison if that fails):
my $p = Parse::CPAN::Distribution->new($gzfilename);
my $dist = $p->distribution('Acme-Color');
Modified: packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages/Distribution.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages/Distribution.pm?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages/Distribution.pm (original)
+++ packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages/Distribution.pm Sat Jun 17 16:55:19 2006
@@ -1,15 +1,15 @@
package Parse::CPAN::Packages::Distribution;
use strict;
use base qw( Class::Accessor::Fast );
-__PACKAGE__->mk_accessors(qw( prefix dist version maturity filename
- cpanid distvname packages ));
-use vars qw($VERSION);
-$VERSION = '2.12';
+__PACKAGE__->mk_accessors(
+ qw( prefix dist version maturity filename
+ cpanid distvname packages )
+);
sub new {
my $class = shift;
- my $self = $class->SUPER::new;
- $self->packages([]);
+ my $self = $class->SUPER::new;
+ $self->packages( [] );
return $self;
}
Modified: packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages/Package.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages/Package.pm?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages/Package.pm (original)
+++ packages/libparse-cpan-packages-perl/trunk/lib/Parse/CPAN/Packages/Package.pm Sat Jun 17 16:55:19 2006
@@ -1,18 +1,16 @@
package Parse::CPAN::Packages::Package;
use strict;
use base qw( Class::Accessor::Fast );
- __PACKAGE__->mk_accessors(qw( package version prefix distribution ));
+__PACKAGE__->mk_accessors(qw( package version prefix distribution ));
use Parse::CPAN::Packages::Distribution;
-use vars qw($VERSION);
-$VERSION = '2.12';
sub new {
- my $class = shift;
+ my $class = shift;
- my $self = {};
- bless $self, $class;
+ my $self = {};
+ bless $self, $class;
- return $self;
+ return $self;
}
1;
Modified: packages/libparse-cpan-packages-perl/trunk/t/simple.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libparse-cpan-packages-perl/trunk/t/simple.t?rev=3092&op=diff
==============================================================================
--- packages/libparse-cpan-packages-perl/trunk/t/simple.t (original)
+++ packages/libparse-cpan-packages-perl/trunk/t/simple.t Sat Jun 17 16:55:19 2006
@@ -5,93 +5,112 @@
use_ok("Parse::CPAN::Packages");
my $p = Parse::CPAN::Packages->new("t/02packages.details.txt");
-isa_ok($p, "Parse::CPAN::Packages");
+isa_ok( $p, "Parse::CPAN::Packages" );
my @packages = sort map { $_->package } $p->packages;
-is_deeply(\@packages,
- [qw(Acme::Colour Acme::Colour::Old Acme::ComeFrom Acme::Comment Acme::CramCode Acme::Currency accessors accessors::chained accessors::classic )]);
+is_deeply(
+ \@packages,
+ [ qw(Acme::Colour Acme::Colour::Old Acme::ComeFrom Acme::Comment Acme::CramCode Acme::Currency accessors accessors::chained accessors::classic )
+ ]
+);
my $m = $p->package("Acme::Colour");
-is($m->package, "Acme::Colour");
-is($m->version, "1.00");
+is( $m->package, "Acme::Colour" );
+is( $m->version, "1.00" );
my $d = $m->distribution;
-is($d->prefix, "L/LB/LBROCARD/Acme-Colour-1.00.tar.gz");
-is($d->dist, "Acme-Colour");
-is($d->version, "1.00");
-is($d->maturity, "released");
-is($d->filename, "Acme-Colour-1.00.tar.gz");
-is($d->cpanid, "LBROCARD");
-is($d->distvname, "Acme-Colour-1.00");
+is( $d->prefix, "L/LB/LBROCARD/Acme-Colour-1.00.tar.gz" );
+is( $d->dist, "Acme-Colour" );
+is( $d->version, "1.00" );
+is( $d->maturity, "released" );
+is( $d->filename, "Acme-Colour-1.00.tar.gz" );
+is( $d->cpanid, "LBROCARD" );
+is( $d->distvname, "Acme-Colour-1.00" );
-is( $p->package("accessors::chained")->distribution->dist, "accessors",
- "accessors::chained lives in accessors" );
+is( $p->package("accessors::chained")->distribution->dist,
+ "accessors", "accessors::chained lives in accessors" );
-is( $p->package("accessors::classic")->distribution->dist, "accessors",
- "as does accessors::classic" );
+is( $p->package("accessors::classic")->distribution->dist,
+ "accessors", "as does accessors::classic" );
is( $p->package("accessors::chained")->distribution,
$p->package("accessors::classic")->distribution,
- "and they're using the same distribution object" );
+ "and they're using the same distribution object"
+);
my $dist = $p->distribution('S/SP/SPURKIS/accessors-0.02.tar.gz');
is( $dist->dist, 'accessors' );
-is( $dist, $p->package("accessors::chained")->distribution,
- "by path match by name" );
+is( $dist,
+ $p->package("accessors::chained")->distribution,
+ "by path match by name"
+);
-is_deeply( [ map { $_->package } $dist->contains ],
- [ qw( accessors accessors::chained accessors::classic ) ],
- "dist contains packages" );
+is_deeply(
+ [ map { $_->package } $dist->contains ],
+ [qw( accessors accessors::chained accessors::classic )],
+ "dist contains packages"
+);
$d = $p->latest_distribution("Acme-Colour");
-is($d->prefix, "L/LB/LBROCARD/Acme-Colour-1.00.tar.gz");
-is($d->version, "1.00");
+is( $d->prefix, "L/LB/LBROCARD/Acme-Colour-1.00.tar.gz" );
+is( $d->version, "1.00" );
-is_deeply([sort map { $_->prefix } $p->latest_distributions], [
- 'A/AU/AUTRIJUS/Acme-ComeFrom-0.07.tar.gz',
- 'K/KA/KANE/Acme-Comment-1.02.tar.gz',
- 'L/LB/LBROCARD/Acme-Colour-1.00.tar.gz',
- 'S/SM/SMUELLER/Acme-Currency-0.01.tar.gz',
- 'S/SP/SPURKIS/accessors-0.02.tar.gz',
- 'X/XE/XERN/Acme-CramCode-0.01.tar.gz',
-]);
+is_deeply(
+ [ sort map { $_->prefix } $p->latest_distributions ],
+ [ 'A/AU/AUTRIJUS/Acme-ComeFrom-0.07.tar.gz',
+ 'K/KA/KANE/Acme-Comment-1.02.tar.gz',
+ 'L/LB/LBROCARD/Acme-Colour-1.00.tar.gz',
+ 'S/SM/SMUELLER/Acme-Currency-0.01.tar.gz',
+ 'S/SP/SPURKIS/accessors-0.02.tar.gz',
+ 'X/XE/XERN/Acme-CramCode-0.01.tar.gz',
+ ]
+);
# counts
-is($p->package_count(), scalar @packages, "package count");
-is($p->distribution_count(), 7, "dist count");
-is($p->latest_distribution_count(), 6, "latest dist count");
+is( $p->package_count(), scalar @packages, "package count" );
+is( $p->distribution_count(), 7, "dist count" );
+is( $p->latest_distribution_count(), 6, "latest dist count" );
-open(IN, "t/02packages.details.txt");
+open( IN, "t/02packages.details.txt" );
my $details = join '', <IN>;
close(IN);
-# Try the interface which takes in the contents
+# Try the interface which takes in the contents
$p = Parse::CPAN::Packages->new($details);
-isa_ok($p, "Parse::CPAN::Packages");
+isa_ok( $p, "Parse::CPAN::Packages" );
@packages = sort map { $_->package } $p->packages;
-is_deeply(\@packages,
- [qw(Acme::Colour Acme::Colour::Old Acme::ComeFrom Acme::Comment Acme::CramCode Acme::Currency accessors accessors::chained accessors::classic )]);
+is_deeply(
+ \@packages,
+ [ qw(Acme::Colour Acme::Colour::Old Acme::ComeFrom Acme::Comment Acme::CramCode Acme::Currency accessors accessors::chained accessors::classic )
+ ]
+);
-# Try the interface which takes in a .gz
+# Try the interface which takes in a .gz
$p = Parse::CPAN::Packages->new("t/02packages.details.txt.gz");
-isa_ok($p, "Parse::CPAN::Packages");
+isa_ok( $p, "Parse::CPAN::Packages" );
@packages = sort map { $_->package } $p->packages;
-is_deeply(\@packages,
- [qw(Acme::Colour Acme::Colour::Old Acme::ComeFrom Acme::Comment Acme::CramCode Acme::Currency accessors accessors::chained accessors::classic )]);
+is_deeply(
+ \@packages,
+ [ qw(Acme::Colour Acme::Colour::Old Acme::ComeFrom Acme::Comment Acme::CramCode Acme::Currency accessors accessors::chained accessors::classic )
+ ]
+);
# Try the interface which takes in gzipped contents
-open(IN, "t/02packages.details.txt.gz");
+open( IN, "t/02packages.details.txt.gz" );
$details = join '', <IN>;
close(IN);
$p = Parse::CPAN::Packages->new($details);
-isa_ok($p, "Parse::CPAN::Packages");
+isa_ok( $p, "Parse::CPAN::Packages" );
@packages = sort map { $_->package } $p->packages;
-is_deeply(\@packages,
- [qw(Acme::Colour Acme::Colour::Old Acme::ComeFrom Acme::Comment Acme::CramCode Acme::Currency accessors accessors::chained accessors::classic )]);
+is_deeply(
+ \@packages,
+ [ qw(Acme::Colour Acme::Colour::Old Acme::ComeFrom Acme::Comment Acme::CramCode Acme::Currency accessors accessors::chained accessors::classic )
+ ]
+);
More information about the Pkg-perl-cvs-commits
mailing list