r30546 - in /branches/upstream/libwww-freshmeat-perl/current: Build.PL Changes MANIFEST META.yml Makefile.PL README lib/WWW/Freshmeat.pm t/boilerplate.t t/nonexistingproject.t t/project.t

antonio-guest at users.alioth.debian.org antonio-guest at users.alioth.debian.org
Mon Feb 9 23:42:09 UTC 2009


Author: antonio-guest
Date: Mon Feb  9 23:42:06 2009
New Revision: 30546

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=30546
Log:
[svn-upgrade] Integrating new upstream version, libwww-freshmeat-perl (0.03)

Added:
    branches/upstream/libwww-freshmeat-perl/current/t/nonexistingproject.t
    branches/upstream/libwww-freshmeat-perl/current/t/project.t
Removed:
    branches/upstream/libwww-freshmeat-perl/current/t/boilerplate.t
Modified:
    branches/upstream/libwww-freshmeat-perl/current/Build.PL
    branches/upstream/libwww-freshmeat-perl/current/Changes
    branches/upstream/libwww-freshmeat-perl/current/MANIFEST
    branches/upstream/libwww-freshmeat-perl/current/META.yml
    branches/upstream/libwww-freshmeat-perl/current/Makefile.PL
    branches/upstream/libwww-freshmeat-perl/current/README
    branches/upstream/libwww-freshmeat-perl/current/lib/WWW/Freshmeat.pm

Modified: branches/upstream/libwww-freshmeat-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-freshmeat-perl/current/Build.PL?rev=30546&op=diff
==============================================================================
--- branches/upstream/libwww-freshmeat-perl/current/Build.PL (original)
+++ branches/upstream/libwww-freshmeat-perl/current/Build.PL Mon Feb  9 23:42:06 2009
@@ -1,3 +1,4 @@
+use 5.006;
 use strict;
 use warnings;
 use Module::Build;
@@ -7,10 +8,14 @@
     license             => 'perl',
     dist_author         => 'Cedric Bouvier <cbouvi at cpan.org>',
     dist_version_from   => 'lib/WWW/Freshmeat.pm',
+    requires => {
+        'LWP::UserAgent' => 0,
+        'XML::Simple' => 0,
+        'perl' => 5.006,
+    },
     build_requires => {
         'Test::More' => 0,
-        'LWP::UserAgent' => 0,
-        'XML::Simple' => 0,
+        'LWP::Online' => 1.06,
     },
     add_to_cleanup      => [ 'WWW-Freshmeat-*' ],
 );

Modified: branches/upstream/libwww-freshmeat-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-freshmeat-perl/current/Changes?rev=30546&op=diff
==============================================================================
--- branches/upstream/libwww-freshmeat-perl/current/Changes (original)
+++ branches/upstream/libwww-freshmeat-perl/current/Changes Mon Feb  9 23:42:06 2009
@@ -1,4 +1,20 @@
 Revision history for WWW-Freshmeat
+
+0.03    2009-02-03
+        - retrieve_project for project that does not exist will return undef
+        - retrieve_project will die if it would not be able to fetch project record
+        - nonexistingproject.t to test this functionality
+        - method for returning id's of trove categories
+        - project_from_xml class method
+        - tests check for connection with LWP::Online
+        - Build.PL now lists modules in 'requires' section
+
+0.02    2009-01-25
+        new maintainer: Alexandr Ciornii
+        - distribution modernized
+        - "project.t" added, a live test
+        - "boilerplate.t" removed
+        - "all rights reserved" removed (by permission of Cedric Bouvier)
 
 0.01    Wed May 31 13:29:17 CEST 2006
         First version, only retrieval of known project entry.

Modified: branches/upstream/libwww-freshmeat-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-freshmeat-perl/current/MANIFEST?rev=30546&op=diff
==============================================================================
--- branches/upstream/libwww-freshmeat-perl/current/MANIFEST (original)
+++ branches/upstream/libwww-freshmeat-perl/current/MANIFEST Mon Feb  9 23:42:06 2009
@@ -6,6 +6,7 @@
 META.yml			# Will be created by "make dist"
 README
 t/00-load.t
-t/boilerplate.t
 t/pod-coverage.t
 t/pod.t
+t/project.t
+t/nonexistingproject.t

Modified: branches/upstream/libwww-freshmeat-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-freshmeat-perl/current/META.yml?rev=30546&op=diff
==============================================================================
--- branches/upstream/libwww-freshmeat-perl/current/META.yml (original)
+++ branches/upstream/libwww-freshmeat-perl/current/META.yml Mon Feb  9 23:42:06 2009
@@ -1,19 +1,24 @@
----
-name: WWW-Freshmeat
-version: 0.01
-author:
-  - 'Cedric Bouvier <cbouvi at cpan.org>'
-abstract: automates searches on Freshmeat.net
-license: perl
-build_requires:
-  LWP::UserAgent: 0
-  Test::More: 0
-  XML::Simple: 0
-provides:
-  WWW::Freshmeat:
-    file: lib/WWW/Freshmeat.pm
-    version: 0.01
-  WWW::Freshmeat::Project:
-    file: lib/WWW/Freshmeat.pm
-    version: 0.01
-generated_by: Module::Build version 0.26
+--- #YAML:1.0
+name:               WWW-Freshmeat
+version:            0.03
+abstract:           automates searches on Freshmeat.net
+author:
+    - Cedric Bouvier <cbouvi at cpan.org>
+license:            perl
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+requires:
+    LWP::Online:     1.06
+    LWP::UserAgent:  0
+    perl:            5.006
+    Test::More:      0
+    XML::Simple:     0
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.48
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: branches/upstream/libwww-freshmeat-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-freshmeat-perl/current/Makefile.PL?rev=30546&op=diff
==============================================================================
--- branches/upstream/libwww-freshmeat-perl/current/Makefile.PL (original)
+++ branches/upstream/libwww-freshmeat-perl/current/Makefile.PL Mon Feb  9 23:42:06 2009
@@ -1,3 +1,4 @@
+use 5.006;
 use strict;
 use warnings;
 use ExtUtils::MakeMaker;
@@ -12,7 +13,12 @@
         'Test::More' => 0,
         'LWP::UserAgent' => 0,
         'XML::Simple' => 0,
+        'LWP::Online' => 1.06,
     },
+    ($ExtUtils::MakeMaker::VERSION ge '6.31'? 
+     ('LICENSE'		=> 'perl', ) : ()),
+    ($ExtUtils::MakeMaker::VERSION ge '6.48'? 
+     ('MIN_PERL_VERSION' => 5.006,) : ()),
     dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
     clean               => { FILES => 'WWW-Freshmeat-*' },
 );

Modified: branches/upstream/libwww-freshmeat-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-freshmeat-perl/current/README?rev=30546&op=diff
==============================================================================
--- branches/upstream/libwww-freshmeat-perl/current/README (original)
+++ branches/upstream/libwww-freshmeat-perl/current/README Mon Feb  9 23:42:06 2009
@@ -45,6 +45,7 @@
 COPYRIGHT AND LICENCE
 
 Copyright (C) 2006 Cedric Bouvier
+Copyright (C) 2009 Alexandr Ciornii.
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

Modified: branches/upstream/libwww-freshmeat-perl/current/lib/WWW/Freshmeat.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-freshmeat-perl/current/lib/WWW/Freshmeat.pm?rev=30546&op=diff
==============================================================================
--- branches/upstream/libwww-freshmeat-perl/current/lib/WWW/Freshmeat.pm (original)
+++ branches/upstream/libwww-freshmeat-perl/current/lib/WWW/Freshmeat.pm Mon Feb  9 23:42:06 2009
@@ -1,7 +1,8 @@
 package WWW::Freshmeat;
 
+use 5.006;
+use strict;
 use warnings;
-use strict;
 
 =head1 NAME
 
@@ -9,11 +10,11 @@
 
 =head1 VERSION
 
-Version 0.01
-
-=cut
-
-our $VERSION = '0.01';
+Version 0.03
+
+=cut
+
+our $VERSION = '0.03';
 
 use XML::Simple qw();
 
@@ -21,7 +22,7 @@
 
     use WWW::Freshmeat;
 
-    my $fm = new WWW::Freshmeat;
+    my $fm = WWW::Freshmeat->new;
 
     my $project = $fm->retrieve_project('project_id');
 
@@ -63,6 +64,7 @@
 sub name        { $_[0]->projectname_full(@_) || $_[0]->projectname_short(@_) } 
 sub description { $_[0]->desc_full(@_) || $_[0]->desc_short(@_) } 
 sub version     { $_[0]{latest_release}{latest_release_version} }
+sub trove_id    { $_[0]{descriminators}{trove_id} }
 
 sub url {
 
@@ -95,7 +97,7 @@
 
 Query the freshmeat.net site for the project I<STRING> (should be the Freshmeat
 ID of the requested project) and returns a C<WWW::Freshmeat::Project> object or
-dies if the project entry cannot be found.
+undef if the project entry cannot be found.
 
 =cut
 
@@ -105,8 +107,29 @@
     my $id   = shift;
 
     my $url = "http://freshmeat.net/projects-xml/$id/$id.xml";
-    my $res = $self->get($url) or die "Could not GET $url";
-    my $xml = $res->content();
+    my $response = $self->get($url);
+    if ($response->is_success) {
+      my $xml = $response->content();
+      return $self->project_from_xml($xml);
+    } else {
+      die "Could not GET $url";
+    }
+}
+
+=item B<project_from_xml> I<STRING>
+
+Receives Freshmeat project XML record and returns a C<WWW::Freshmeat::Project>
+object or undef if the project entry cannot be found.
+
+=cut
+
+sub project_from_xml {
+    my $self = shift;
+    my $xml  = shift;
+
+    if ($xml eq 'Error: project not found.') {
+      return undef;
+    }
 
     my $data = XML::Simple::XMLin($xml);
 
@@ -138,7 +161,7 @@
 
 =back
 
-Additionnally, it provides the following "higher-level" methods:
+Additionally, it provides the following "higher-level" methods:
 
 =over 4
 
@@ -212,7 +235,8 @@
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2006 Cedric Bouvier, all rights reserved.
+Copyright 2006 Cedric Bouvier.
+Copyright 2009 Alexandr Ciornii.
 
 This program is free software; you can redistribute it and/or modify it
 under the same terms as Perl itself.

Added: branches/upstream/libwww-freshmeat-perl/current/t/nonexistingproject.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-freshmeat-perl/current/t/nonexistingproject.t?rev=30546&op=file
==============================================================================
--- branches/upstream/libwww-freshmeat-perl/current/t/nonexistingproject.t (added)
+++ branches/upstream/libwww-freshmeat-perl/current/t/nonexistingproject.t Mon Feb  9 23:42:06 2009
@@ -1,0 +1,14 @@
+#!perl
+
+use strict;
+use warnings;
+use LWP::Online ':skip_all';
+use Test::More tests => 2;
+
+use WWW::Freshmeat;
+
+my $fm = WWW::Freshmeat->new;
+isa_ok($fm,'WWW::Freshmeat');
+
+my $project = $fm->retrieve_project('nonexistingproject');
+ok(!defined($project));

Added: branches/upstream/libwww-freshmeat-perl/current/t/project.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libwww-freshmeat-perl/current/t/project.t?rev=30546&op=file
==============================================================================
--- branches/upstream/libwww-freshmeat-perl/current/t/project.t (added)
+++ branches/upstream/libwww-freshmeat-perl/current/t/project.t Mon Feb  9 23:42:06 2009
@@ -1,0 +1,27 @@
+#!perl -T
+
+use strict;
+use warnings;
+use LWP::Online ':skip_all';
+use Test::More tests => 12;
+
+use WWW::Freshmeat;
+
+my $fm = WWW::Freshmeat->new;
+isa_ok($fm,'WWW::Freshmeat');
+
+my $project = $fm->retrieve_project('hook_lexwrap');
+
+isa_ok($project,'WWW::Freshmeat::Project');
+is($project->name(),'Hook::LexWrap');
+is($project->url(),'http://search.cpan.org/dist/Hook-LexWrap/');
+is($project->license(),'Perl License');
+my @trove=@{$project->trove_id()};
+my %hash;
+ at hash{@trove}=();
+foreach my $t (11,3,902,235,176,809,910) {
+  ok(exists $hash{$t},"id $t is present");
+}
+#902 - OSI Approved :: Perl License
+#176 - Perl
+#910 - Software Development :: Libraries :: Perl Modules




More information about the Pkg-perl-cvs-commits mailing list