r31663 - in /trunk/libwww-freshmeat-perl: Build.PL Changes MANIFEST META.yml Makefile.PL debian/changelog debian/compat debian/control debian/copyright debian/rules lib/WWW/Freshmeat.pm t/project.t xt/

antonio-guest at users.alioth.debian.org antonio-guest at users.alioth.debian.org
Sun Mar 8 00:14:22 UTC 2009


Author: antonio-guest
Date: Sun Mar  8 00:14:13 2009
New Revision: 31663

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=31663
Log:
* New upstream release
* debian/control: 
  + adding myself to the Uploaders
  + debhelper >= 7
  + removed libmodule-build-perl dependency because it is supplied by
    perl-modules
  + added liblwp-online-perl to the dependencies
* debian/compat bumped to 7
* debian/rules refreshed by dh-make-perl --dh 7 --refresh

Added:
    trunk/libwww-freshmeat-perl/xt/
      - copied from r31446, branches/upstream/libwww-freshmeat-perl/current/xt/
Modified:
    trunk/libwww-freshmeat-perl/Build.PL
    trunk/libwww-freshmeat-perl/Changes
    trunk/libwww-freshmeat-perl/MANIFEST
    trunk/libwww-freshmeat-perl/META.yml
    trunk/libwww-freshmeat-perl/Makefile.PL
    trunk/libwww-freshmeat-perl/debian/changelog
    trunk/libwww-freshmeat-perl/debian/compat
    trunk/libwww-freshmeat-perl/debian/control
    trunk/libwww-freshmeat-perl/debian/copyright
    trunk/libwww-freshmeat-perl/debian/rules
    trunk/libwww-freshmeat-perl/lib/WWW/Freshmeat.pm
    trunk/libwww-freshmeat-perl/t/project.t

Modified: trunk/libwww-freshmeat-perl/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/Build.PL?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/Build.PL (original)
+++ trunk/libwww-freshmeat-perl/Build.PL Sun Mar  8 00:14:13 2009
@@ -1,4 +1,4 @@
-use 5.006;
+use 5.008;
 use strict;
 use warnings;
 use Module::Build;
@@ -6,15 +6,16 @@
 my $builder = Module::Build->new(
     module_name         => 'WWW::Freshmeat',
     license             => 'perl',
-    dist_author         => 'Cedric Bouvier <cbouvi at cpan.org>',
+    dist_author         => 'Alexandr Ciornii <alexchorny at gmail.com>',
     dist_version_from   => 'lib/WWW/Freshmeat.pm',
     requires => {
         'LWP::UserAgent' => 0,
         'XML::Simple' => 0,
-        'perl' => 5.006,
+        'perl' => 5.008,
+        'HTML::TreeBuilder::XPath' => 0.09,
     },
     build_requires => {
-        'Test::More' => 0,
+        'Test::More' => 0.17, #isa_ok
         'LWP::Online' => 1.06,
     },
     add_to_cleanup      => [ 'WWW-Freshmeat-*' ],

Modified: trunk/libwww-freshmeat-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/Changes?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/Changes (original)
+++ trunk/libwww-freshmeat-perl/Changes Sun Mar  8 00:14:13 2009
@@ -1,4 +1,22 @@
 Revision history for WWW-Freshmeat
+
+0.12    2009-02-18
+        - added $WWW::Freshmeat::Project::project_re - regexp for project name
+        - url_list will work with projects containing '.'
+        - added real_author to fetch name of author (not maintainer)
+
+0.11    2009-02-15
+        - url_list has argument to try to floow Freshmeat redirect links
+        - rewrote redir_url not to fetch page it was redirected to
+
+0.10    2009-02-14
+        - 5.008 only (due to 'ISO-8859-1' encoding of XML file)
+        - projectname_short project method for retrieving project string id
+        - HTML::TreeBuilder::XPath is now required
+        - supports fetching branch list
+        - url_list project method for retrieving project URL list
+        - popularity project method for retrieving project popularity data
+        - redir_url in WWW::Freshmeat to fetch url which link will redirect to
 
 0.03    2009-02-03
         - retrieve_project for project that does not exist will return undef

Modified: trunk/libwww-freshmeat-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/MANIFEST?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/MANIFEST (original)
+++ trunk/libwww-freshmeat-perl/MANIFEST Sun Mar  8 00:14:13 2009
@@ -10,3 +10,4 @@
 t/pod.t
 t/project.t
 t/nonexistingproject.t
+xt/project1.t

Modified: trunk/libwww-freshmeat-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/META.yml?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/META.yml (original)
+++ trunk/libwww-freshmeat-perl/META.yml Sun Mar  8 00:14:13 2009
@@ -1,19 +1,20 @@
 --- #YAML:1.0
 name:               WWW-Freshmeat
-version:            0.03
+version:            0.12
 abstract:           automates searches on Freshmeat.net
 author:
-    - Cedric Bouvier <cbouvi at cpan.org>
+    - Alexandr Ciornii <alexchorny at gmail.com>
 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
+    HTML::TreeBuilder::XPath:  0.09
+    LWP::Online:          1.06
+    LWP::UserAgent:       0
+    perl:                 5.008
+    Test::More:           0.17
+    XML::Simple:          0
 no_index:
     directory:
         - t

Modified: trunk/libwww-freshmeat-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/Makefile.PL?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/Makefile.PL (original)
+++ trunk/libwww-freshmeat-perl/Makefile.PL Sun Mar  8 00:14:13 2009
@@ -1,24 +1,25 @@
-use 5.006;
+use 5.008;
 use strict;
 use warnings;
 use ExtUtils::MakeMaker;
 
 WriteMakefile(
     NAME                => 'WWW::Freshmeat',
-    AUTHOR              => 'Cedric Bouvier <cbouvi at cpan.org>',
+    AUTHOR              => 'Alexandr Ciornii <alexchorny at gmail.com>',
     VERSION_FROM        => 'lib/WWW/Freshmeat.pm',
     ABSTRACT_FROM       => 'lib/WWW/Freshmeat.pm',
     PL_FILES            => {},
     PREREQ_PM => {
-        'Test::More' => 0,
+        'Test::More' => 0.17, #isa_ok
         'LWP::UserAgent' => 0,
         'XML::Simple' => 0,
         'LWP::Online' => 1.06,
+        'HTML::TreeBuilder::XPath' => 0.09,
     },
     ($ExtUtils::MakeMaker::VERSION ge '6.31'? 
      ('LICENSE'		=> 'perl', ) : ()),
     ($ExtUtils::MakeMaker::VERSION ge '6.48'? 
-     ('MIN_PERL_VERSION' => 5.006,) : ()),
+     ('MIN_PERL_VERSION' => 5.008,) : ()),
     dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
     clean               => { FILES => 'WWW-Freshmeat-*' },
 );

Modified: trunk/libwww-freshmeat-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/debian/changelog?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/debian/changelog (original)
+++ trunk/libwww-freshmeat-perl/debian/changelog Sun Mar  8 00:14:13 2009
@@ -1,8 +1,15 @@
-libwww-freshmeat-perl (0.03-1) UNRELEASED; urgency=low
+libwww-freshmeat-perl (0.12-1) unstable; urgency=low
 
-  NOTE: this package is pending the upload of a dependency:
-  liblwp-online-perl, it was already packaged and it is now
-  pending upload from ftp-master (see ITP #514679)
+  [ Antonio Radici ]
+  * New upstream release
+  * debian/control: 
+    + adding myself to the Uploaders
+    + debhelper >= 7
+    + removed libmodule-build-perl dependency because it is supplied by
+      perl-modules
+    + added liblwp-online-perl to the dependencies
+  * debian/compat bumped to 7
+  * debian/rules refreshed by dh-make-perl --dh 7 --refresh
 
   [ Gregor Herrmann ]
   * debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser
@@ -12,19 +19,13 @@
     .packlist file any more.
   * debian/watch: use dist-based URL.
   * debian/copyright: add upstream source location; wrap a long line.
-  * Set debhelper compatibility level to 5.
   * Set Standards-Version to 3.8.0 (no changes).
   * debian/control: change my email address.
   * Move libmodule-build-perl to Build-Depends.
   * debian/control: Changed: Switched Vcs-Browser field to ViewSVN
     (source stanza).
 
-  [ Antonio Radici ]
-  * New upstream release
-  * debian/control: 
-    + adding myself to the Uploaders
-
- -- Antonio Radici <antonio at dyne.org>  Mon, 09 Feb 2009 22:55:57 +0000
+ -- Antonio Radici <antonio at dyne.org>  Thu, 05 Mar 2009 00:38:03 +0000
 
 libwww-freshmeat-perl (0.01-3) unstable; urgency=low
 

Modified: trunk/libwww-freshmeat-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/debian/compat?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/debian/compat (original)
+++ trunk/libwww-freshmeat-perl/debian/compat Sun Mar  8 00:14:13 2009
@@ -1,1 +1,1 @@
-5
+7

Modified: trunk/libwww-freshmeat-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/debian/control?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/debian/control (original)
+++ trunk/libwww-freshmeat-perl/debian/control Sun Mar  8 00:14:13 2009
@@ -1,8 +1,9 @@
 Source: libwww-freshmeat-perl
 Section: perl
 Priority: optional
-Build-Depends: debhelper (>= 5), libmodule-build-perl
-Build-Depends-Indep: perl (>= 5.8.0-7), libwww-perl, libxml-simple-perl, libtest-pod-perl, libtest-pod-coverage-perl
+Build-Depends: debhelper (>= 7)
+Build-Depends-Indep: perl (>= 5.8.0-7), libwww-perl, libxml-simple-perl, libtest-pod-perl, libtest-pod-coverage-perl,
+ liblwp-online-perl, libhtml-treebuilder-xpath-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: gregor herrmann <gregoa at debian.org>, Antonio Radici <antonio at dyne.org>
 Standards-Version: 3.8.0
@@ -12,7 +13,8 @@
 
 Package: libwww-freshmeat-perl
 Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, 
+Depends: ${perl:Depends}, ${misc:Depends}, liblw-online-perl, libwww-perl, libxml-simple-perl, 
+ libhtml-treebuilder-xpath-perl
 Description: automates searches on Freshmeat.net
  WWW::Freshmeat allows you to fetch projects information from
  Freshmeat, such as name, URL, version and description.

Modified: trunk/libwww-freshmeat-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/debian/copyright?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/debian/copyright (original)
+++ trunk/libwww-freshmeat-perl/debian/copyright Sun Mar  8 00:14:13 2009
@@ -1,21 +1,33 @@
-This is the debian package for the WWW-Freshmeat module.
-It was created by David Moreno Garza <damog at cerdita.damog.net> using
-dh-make-perl and is maintained by the Debian Perl Group.
+Format-Specification:
+    http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
+Upstream-Maintainer: Alexandr Ciornii <alexchorny at gmail.com>
+Upstream-Source: http://search.cpan.org/dist/WWW-Freshmeat/
+Upstream-Name: WWW-Freshmeat
 
-Upstream source location: http://search.cpan.org/dist/WWW-Freshmeat/
+Files: *
+Copyright: 
+ (c) 2006, Cedric Bouvier
+ (c) 2009, Alexandr Ciornii <alexchorny at gmail.com>
+License-Alias: Perl
+License: Artistic | GPL-1+
 
-The upstream author is: Cedric Bouvier <cbouvi at cpan.org>.
+Files: debian/*
+Copyright: 
+ (c) 2006, David Moreno Garza <damog at debian.org>
+ (c) 2006-2009, gregor herrmann <gregoa at debian.org>
+ (c) 2009, Antonio Radici <antonio at dyne.org>
+License: Artistic | GPL-1+
 
-Copyright 2006 Cedric Bouvier, all rights reserved.
+License: Artistic
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the Artistic License, which comes with Perl.
+    On Debian GNU/Linux systems, the complete text of the Artistic License
+    can be found in `/usr/share/common-licenses/Artistic'
 
-This program is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
-
-Perl is distributed under your choice of the GNU General Public License or
-the Artistic License.  On Debian GNU/Linux systems, the complete text of the
-GNU General Public License can be found in `/usr/share/common-licenses/GPL'
-and the Artistic Licence in `/usr/share/common-licenses/Artistic'.
-
-You can find the pristine source for this module directly from:
- http://search.cpan.org/CPAN/modules/by-module/WWW/
- 
+License: GPL-1+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 1, or (at your option)
+    any later version.
+    On Debian GNU/Linux systems, the complete text of the GNU General
+    Public License can be found in `/usr/share/common-licenses/GPL'

Modified: trunk/libwww-freshmeat-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/debian/rules?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/debian/rules (original)
+++ trunk/libwww-freshmeat-perl/debian/rules Sun Mar  8 00:14:13 2009
@@ -1,60 +1,23 @@
 #!/usr/bin/make -f
-# This debian/rules file is provided as a template for normal perl
-# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
-# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
-# be used freely wherever it is useful.
-#
-# It was later modified by Jason Kohles <email at jasonkohles.com>
-# http://www.jasonkohles.com/ to support Module::Build installed modules
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-# If set to a true value then MakeMaker's prompt function will
-# always return the default without waiting for user input.
-export PERL_MM_USE_DEFAULT=1
-
-PERL   ?= /usr/bin/perl
-PACKAGE = $(shell dh_listpackages)
-TMP     = $(CURDIR)/debian/$(PACKAGE)
 
 build: build-stamp
 build-stamp:
-	dh_testdir
-	$(PERL) Build.PL installdirs=vendor
-	$(PERL) Build
-	$(PERL) Build test
+	dh build
 	touch $@
 
 clean:
-	dh_testdir
-	dh_testroot
-	dh_clean build-stamp install-stamp
-	[ ! -f Build ] || $(PERL) Build --allow_mb_mismatch 1 distclean
+	dh $@
 
 install: install-stamp
 install-stamp: build-stamp
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-	$(PERL) Build install destdir=$(TMP) create_packlist=0
+	dh install
 	touch $@
 
 binary-arch:
-# We have nothing to do here for an architecture-independent package
 
-binary-indep: build install
-	dh_testdir
-	dh_testroot
-	dh_installdocs README
-	dh_installchangelogs Changes
-	dh_perl
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
+binary-indep: install
+	dh $@
 
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+binary: binary-arch binary-indep
+
+.PHONY: binary binary-arch binary-indep install clean build

Modified: trunk/libwww-freshmeat-perl/lib/WWW/Freshmeat.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/lib/WWW/Freshmeat.pm?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/lib/WWW/Freshmeat.pm (original)
+++ trunk/libwww-freshmeat-perl/lib/WWW/Freshmeat.pm Sun Mar  8 00:14:13 2009
@@ -1,6 +1,6 @@
 package WWW::Freshmeat;
 
-use 5.006;
+use 5.008;
 use strict;
 use warnings;
 
@@ -10,11 +10,11 @@
 
 =head1 VERSION
 
-Version 0.03
-
-=cut
-
-our $VERSION = '0.03';
+Version 0.12
+
+=cut
+
+our $VERSION = '0.12';
 
 use XML::Simple qw();
 
@@ -26,11 +26,11 @@
 
     my $project = $fm->retrieve_project('project_id');
 
-    foreach ( @projects, $project ) {
-        print $_->name(), "\n";
-        print $_->url(), "\n";
-        print $_->version(), "\n";
-        print $_->description(), "\n";
+    foreach my $p ( @projects, $project ) {
+        print $p->name(), "\n";
+        print $p->url(), "\n";
+        print $p->version(), "\n";
+        print $p->description(), "\n";
     }
 
 =cut
@@ -47,7 +47,7 @@
     return $self;
 }
 
-foreach my $field ( qw( url_project_page url_homepage projectname_full desc_short desc_full license www_freshmeat ) ) {
+foreach my $field ( qw( url_project_page url_homepage projectname_full desc_short desc_full license www_freshmeat projectname_short) ) {
     no strict 'refs';
     *$field = sub {
         my $self = shift;
@@ -67,18 +67,126 @@
 sub trove_id    { $_[0]{descriminators}{trove_id} }
 
 sub url {
-
     my $self = shift;
     return $self->{url} if $self->{url};
     my $freshmeat_url = $self->{url_project_page};
 
     my $url = $self->url_homepage() or return;
 
-    my $res = $self->www_freshmeat()->get($url) or return $self->{url} = $freshmeat_url;
-    my $req = $res->request() or return $self->{url} = $freshmeat_url;
-    my $uri = $req->uri() or return $self->{url} = $freshmeat_url;
-    return $self->{url} = $uri->as_string();
-}
+    $self->{url} = $self->www_freshmeat()->redir_url($url);
+    return $self->{url};
+}
+
+sub init_html {
+    my $self = shift;
+    my $html = shift;
+    require HTML::TreeBuilder::XPath;
+    $self->{_html}=HTML::TreeBuilder::XPath->new_from_content($html);
+}
+
+sub _html_tree {
+    my $self = shift;
+    if (!$self->{_html}) {
+      my $id=$self->projectname_short();
+      my $url = "http://freshmeat.net/projects/$id/";
+      $self->www_freshmeat()->agent('User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.8.1.19) Gecko/20081201 Firefox/2.0.0.19');
+      my $response = $self->www_freshmeat()->get($url);
+      my $html = $response->content();
+      if ($response->is_success) {
+        $self->init_html($html);
+      } else {
+        die "Could not GET $url (".$response->status_line.", $html)";
+      }
+    }
+    return $self->{_html};
+}
+
+sub branches {
+    my $self = shift;
+    my $tree=$self->_html_tree();
+    my $nodes=$tree->findnodes(q{//table/tr/th/b[text()='Branch']/../../following-sibling::tr/td[1]/a});
+    my %list;
+    while (my $node=$nodes->shift) {
+      if ($node->attr('href') =~m#/branches/(\d+)/#) {
+        $list{$1}=$node->as_text();
+      } else {
+        die;
+      }
+    }
+    return %list;
+}
+
+our $project_re=qr/[a-z0-9_\-\.]+/;
+sub url_list {
+    my $self = shift;
+    my $real=(@_>0?1:0);
+    my $tree=$self->_html_tree();
+    my $nodes=$tree->findnodes(q{/html/body/div/table/tr/td/table/tr/td/p/a[@href=~/\/redir/]}); #/
+    my %list;
+    while (my $node=$nodes->shift) {
+      if ($node->attr('href') =~m#/redir/$project_re/\d+/(url_\w+)/#) {
+        my $type=$1;
+        my $text=$node->as_text();
+        if ($text=~/\Q[..]\E/) {
+          if ($real) {
+            $list{$type}=$self->www_freshmeat()->redir_url('http://freshmeat.net'.$node->attr('href'));
+          } else {
+            $list{$type}=$node->attr('href');
+          }
+        } else {
+          $list{$type}=$text;
+        }
+      } else {
+        die "bad link:".$node->attr('href');
+      }
+    }
+    return %list;
+}
+
+my %popularity_conv=('Record hits'=>'record_hits','URL hits'=>'url_hits','Subscribers'=>'subscribers');
+sub popularity {
+    my $self = shift;
+    my $tree=$self->_html_tree();
+    my $nodes=$tree->findnodes(q{/html/body/div[1]/table/tr/td[2]/table/tr[3]/td[3]/table[2]/tr/td/small});
+    my %list;
+    if (my $node=$nodes->shift) {
+      my $text=$node->as_text();
+      $text=~s/ / /g;
+      my @list=grep {$_} split /<br(?: \/)?>|\s{4}/,$text;
+      foreach my $s (@list) {
+        $s=~s/^(?:^&nbsp;|\s)+//s;
+        $s=~s/\s+$//s;
+        #print "F:$s\n";
+        if ($s=~/(\w[\w\s]+\w):\s+([\d,]+)/ and exists $popularity_conv{$1}) {
+          my $type=$popularity_conv{$1};
+          my $num=$2;
+          $num=~s/,//g;
+          $list{$type}=$num;
+        } else {
+          die "Cannot find popularity record: '$s'";
+        }
+        
+      }
+    } else {
+      die "Cannot find popularity data";
+    }
+    return %list;
+}
+
+sub real_author {
+    my $self = shift;
+    my $tree=$self->_html_tree();
+    my $nodes=$tree->findnodes(q{/html/body/div[1]/table/tr/td[2]/table/tr[3]/td[1]/p[2]/b/..});
+    my %list;
+    if (my $node=$nodes->shift) {
+      my $text=$node->as_text;
+      $text=~s/^Author:\s+//s;
+      $text=~s/\s+\Q[contact developer]\E\s*$//s;
+      $text=~s/\s+<[^<>]+>\s*$//s;
+      return $text;
+    }
+}
+
 
 package WWW::Freshmeat;
 
@@ -136,6 +244,35 @@
     return WWW::Freshmeat::Project->new($data->{'project'}, $self);
 }
 
+
+=item B<redir_url> I<STRING>
+
+Receives URL and returns URL which it redirects to.
+
+=cut
+
+sub redir_url {
+    my $self = shift;
+    my $url=shift;
+    $self->requests_redirectable([]);
+    my $response = $self->get($url) or return $url;
+    if ($response->is_redirect) {
+      #http://www.perlmonks.org/?node_id=147608
+      my $referral_uri = $response->header('Location');
+      {
+          # Some servers erroneously return a relative URL for redirects,
+          # so make it absolute if it not already is.
+          local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1;
+          my $base = $response->base;
+          $referral_uri = $HTTP::URI_CLASS->new($referral_uri, $base)
+                      ->abs($base);
+      }
+      return $referral_uri;
+    } else {
+      return $url;
+    }
+}
+
 =back
 
 =head2 WWW::Freshmeat::Project methods
@@ -156,6 +293,10 @@
 =item B<desc_full>
 
 =item B<license>
+
+=item B<trove_id>
+
+=item B<projectname_short>
 
 =item B<www_freshmeat>
 
@@ -183,7 +324,27 @@
 returns the actual homepage URL if it can be found, or the URL to the
 freshmeat.net entry for the project.
 
+=item B<branches>
+
+List of branches for project. Returns hash in form of (branch id => branch name).
+
+=item B<popularity>
+
+Freshmeat popularity data for project. Returns hash with keys
+record_hits, url_hits, subscribers
+
+=item B<url_list>
+
+Returns list of URLs for project. You may need to use redir_url to get real link
+or just pass 1 as argument.
+
+=item B<real_author>
+
+Returns name of author (not maintainer).
+
 =back
+
+
 
 =head1 SEE ALSO
 

Modified: trunk/libwww-freshmeat-perl/t/project.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libwww-freshmeat-perl/t/project.t?rev=31663&op=diff
==============================================================================
--- trunk/libwww-freshmeat-perl/t/project.t (original)
+++ trunk/libwww-freshmeat-perl/t/project.t Sun Mar  8 00:14:13 2009
@@ -1,11 +1,11 @@
-#!perl -T
+#!perl
 
 use strict;
 use warnings;
 use LWP::Online ':skip_all';
-use Test::More tests => 12;
+use Test::More tests => 18;
 
-use WWW::Freshmeat;
+use WWW::Freshmeat 0.12;
 
 my $fm = WWW::Freshmeat->new;
 isa_ok($fm,'WWW::Freshmeat');
@@ -14,7 +14,7 @@
 
 isa_ok($project,'WWW::Freshmeat::Project');
 is($project->name(),'Hook::LexWrap');
-is($project->url(),'http://search.cpan.org/dist/Hook-LexWrap/');
+#is($project->url(),'http://search.cpan.org/dist/Hook-LexWrap/');
 is($project->license(),'Perl License');
 my @trove=@{$project->trove_id()};
 my %hash;
@@ -25,3 +25,15 @@
 #902 - OSI Approved :: Perl License
 #176 - Perl
 #910 - Software Development :: Libraries :: Perl Modules
+is($project->projectname_short(),'hook_lexwrap');
+is_deeply({$project->branches()},{'77120'=>'Default'},'branches');
+#%hash=$project->url_list;
+is_deeply({$project->url_list()},{
+'url_homepage'=>'http://search.cpan.org/dist/Hook-LexWrap/',
+'url_bugtracker'=>'http://rt.cpan.org/NoAuth/Bugs.html?Dist=Hook-LexWrap',
+},'URLs');
+my %pop=$project->popularity();
+cmp_ok($pop{'record_hits'},'>=',442);
+cmp_ok($pop{'url_hits'},'>=',216);
+cmp_ok($pop{'subscribers'},'>=',0);
+is($project->real_author(),'Damian Conway');




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