r3804 - in /packages/libwww-freshmeat-perl: ./ branches/ branches/upstream/ branches/upstream/current/ branches/upstream/current/lib/ branches/upstream/current/lib/WWW/ branches/upstream/current/t/ tags/

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Thu Sep 14 23:00:49 UTC 2006


Author: gregoa-guest
Date: Thu Sep 14 23:00:49 2006
New Revision: 3804

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3804
Log:
[svn-inject] Installing original source of libwww-freshmeat-perl

Added:
    packages/libwww-freshmeat-perl/
    packages/libwww-freshmeat-perl/branches/
    packages/libwww-freshmeat-perl/branches/upstream/
    packages/libwww-freshmeat-perl/branches/upstream/current/
    packages/libwww-freshmeat-perl/branches/upstream/current/Build.PL
    packages/libwww-freshmeat-perl/branches/upstream/current/Changes
    packages/libwww-freshmeat-perl/branches/upstream/current/MANIFEST
    packages/libwww-freshmeat-perl/branches/upstream/current/META.yml
    packages/libwww-freshmeat-perl/branches/upstream/current/Makefile.PL
    packages/libwww-freshmeat-perl/branches/upstream/current/README
    packages/libwww-freshmeat-perl/branches/upstream/current/lib/
    packages/libwww-freshmeat-perl/branches/upstream/current/lib/WWW/
    packages/libwww-freshmeat-perl/branches/upstream/current/lib/WWW/Freshmeat.pm
    packages/libwww-freshmeat-perl/branches/upstream/current/t/
    packages/libwww-freshmeat-perl/branches/upstream/current/t/00-load.t
    packages/libwww-freshmeat-perl/branches/upstream/current/t/boilerplate.t
    packages/libwww-freshmeat-perl/branches/upstream/current/t/pod-coverage.t
    packages/libwww-freshmeat-perl/branches/upstream/current/t/pod.t
    packages/libwww-freshmeat-perl/tags/

Added: packages/libwww-freshmeat-perl/branches/upstream/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-freshmeat-perl/branches/upstream/current/Build.PL?rev=3804&op=file
==============================================================================
--- packages/libwww-freshmeat-perl/branches/upstream/current/Build.PL (added)
+++ packages/libwww-freshmeat-perl/branches/upstream/current/Build.PL Thu Sep 14 23:00:49 2006
@@ -1,0 +1,18 @@
+use strict;
+use warnings;
+use Module::Build;
+
+my $builder = Module::Build->new(
+    module_name         => 'WWW::Freshmeat',
+    license             => 'perl',
+    dist_author         => 'Cedric Bouvier <cbouvi at cpan.org>',
+    dist_version_from   => 'lib/WWW/Freshmeat.pm',
+    build_requires => {
+        'Test::More' => 0,
+        'LWP::UserAgent' => 0,
+        'XML::Simple' => 0,
+    },
+    add_to_cleanup      => [ 'WWW-Freshmeat-*' ],
+);
+
+$builder->create_build_script();

Added: packages/libwww-freshmeat-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-freshmeat-perl/branches/upstream/current/Changes?rev=3804&op=file
==============================================================================
--- packages/libwww-freshmeat-perl/branches/upstream/current/Changes (added)
+++ packages/libwww-freshmeat-perl/branches/upstream/current/Changes Thu Sep 14 23:00:49 2006
@@ -1,0 +1,5 @@
+Revision history for WWW-Freshmeat
+
+0.01    Wed May 31 13:29:17 CEST 2006
+        First version, only retrieval of known project entry.
+

Added: packages/libwww-freshmeat-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-freshmeat-perl/branches/upstream/current/MANIFEST?rev=3804&op=file
==============================================================================
--- packages/libwww-freshmeat-perl/branches/upstream/current/MANIFEST (added)
+++ packages/libwww-freshmeat-perl/branches/upstream/current/MANIFEST Thu Sep 14 23:00:49 2006
@@ -1,0 +1,11 @@
+Build.PL
+Changes
+lib/WWW/Freshmeat.pm
+Makefile.PL
+MANIFEST
+META.yml			# Will be created by "make dist"
+README
+t/00-load.t
+t/boilerplate.t
+t/pod-coverage.t
+t/pod.t

Added: packages/libwww-freshmeat-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-freshmeat-perl/branches/upstream/current/META.yml?rev=3804&op=file
==============================================================================
--- packages/libwww-freshmeat-perl/branches/upstream/current/META.yml (added)
+++ packages/libwww-freshmeat-perl/branches/upstream/current/META.yml Thu Sep 14 23:00:49 2006
@@ -1,0 +1,19 @@
+---
+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

Added: packages/libwww-freshmeat-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-freshmeat-perl/branches/upstream/current/Makefile.PL?rev=3804&op=file
==============================================================================
--- packages/libwww-freshmeat-perl/branches/upstream/current/Makefile.PL (added)
+++ packages/libwww-freshmeat-perl/branches/upstream/current/Makefile.PL Thu Sep 14 23:00:49 2006
@@ -1,0 +1,18 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+    NAME                => 'WWW::Freshmeat',
+    AUTHOR              => 'Cedric Bouvier <cbouvi at cpan.org>',
+    VERSION_FROM        => 'lib/WWW/Freshmeat.pm',
+    ABSTRACT_FROM       => 'lib/WWW/Freshmeat.pm',
+    PL_FILES            => {},
+    PREREQ_PM => {
+        'Test::More' => 0,
+        'LWP::UserAgent' => 0,
+        'XML::Simple' => 0,
+    },
+    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+    clean               => { FILES => 'WWW-Freshmeat-*' },
+);

Added: packages/libwww-freshmeat-perl/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-freshmeat-perl/branches/upstream/current/README?rev=3804&op=file
==============================================================================
--- packages/libwww-freshmeat-perl/branches/upstream/current/README (added)
+++ packages/libwww-freshmeat-perl/branches/upstream/current/README Thu Sep 14 23:00:49 2006
@@ -1,0 +1,50 @@
+WWW-Freshmeat
+
+This modules aims at automating searches for Free Software project entries in
+the Freshmeat.net directory. It is currently in very alpha stage, with very
+limited functionality (retrieving data for a project you already know of).
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+    perl Makefile.PL
+    make
+    make test
+    make install
+
+
+Alternatively, to install with Module::Build, you can use the following commands:
+
+    perl Build.PL
+    ./Build
+    ./Build test
+    ./Build install
+
+
+SUPPORT AND DOCUMENTATION
+
+After installing, you can find documentation for this module with the perldoc command.
+
+    perldoc WWW::Freshmeat
+
+You can also look for information at:
+
+    Search CPAN
+        http://search.cpan.org/dist/WWW-Freshmeat
+
+    CPAN Request Tracker:
+        http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Freshmeat
+
+    AnnoCPAN, annotated CPAN documentation:
+        http://annocpan.org/dist/WWW-Freshmeat
+
+    CPAN Ratings:
+        http://cpanratings.perl.org/d/WWW-Freshmeat
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2006 Cedric Bouvier
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.

Added: packages/libwww-freshmeat-perl/branches/upstream/current/lib/WWW/Freshmeat.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-freshmeat-perl/branches/upstream/current/lib/WWW/Freshmeat.pm?rev=3804&op=file
==============================================================================
--- packages/libwww-freshmeat-perl/branches/upstream/current/lib/WWW/Freshmeat.pm (added)
+++ packages/libwww-freshmeat-perl/branches/upstream/current/lib/WWW/Freshmeat.pm Thu Sep 14 23:00:49 2006
@@ -1,0 +1,222 @@
+package WWW::Freshmeat;
+
+use warnings;
+use strict;
+
+=head1 NAME
+
+WWW::Freshmeat - automates searches on Freshmeat.net
+
+=head1 VERSION
+
+Version 0.01
+
+=cut
+
+our $VERSION = '0.01';
+
+use XML::Simple qw();
+
+=head1 SYNOPSIS
+
+    use WWW::Freshmeat;
+
+    my $fm = new WWW::Freshmeat;
+
+    my $project = $fm->retrieve_project('project_id');
+
+    foreach ( @projects, $project ) {
+        print $_->name(), "\n";
+        print $_->url(), "\n";
+        print $_->version(), "\n";
+        print $_->description(), "\n";
+    }
+
+=cut
+
+package WWW::Freshmeat::Project;
+
+sub new {
+
+    my $proto = shift;
+    my $class = ref($proto) || $proto;
+
+    my $self = bless shift, $class;
+    $self->{www_freshmeat} = shift;
+    return $self;
+}
+
+foreach my $field ( qw( url_project_page url_homepage projectname_full desc_short desc_full license www_freshmeat ) ) {
+    no strict 'refs';
+    *$field = sub {
+        my $self = shift;
+        my $value = $self->{$field};
+        if ( ref($value) && ref($value) eq 'HASH' && !(keys %$value) ) {
+            return undef;
+        }
+        else {
+            return $value;
+        }
+    }
+}
+
+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 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();
+}
+
+package WWW::Freshmeat;
+
+use base qw( LWP::UserAgent );
+
+=head1 DESCRIPTION
+
+C<WWW::Freshmeat> derives from C<LWP::UserAgent>, so it accepts all the methods
+that C<LWP::UserAgent> does, notably C<timeout>, C<useragent>, C<env_proxy>...
+
+=head2 Methods
+
+=over 4
+
+=item B<retrieve_project> I<STRING>
+
+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.
+
+=cut
+
+sub retrieve_project {
+
+    my $self = shift;
+    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 $data = XML::Simple::XMLin($xml);
+
+    return WWW::Freshmeat::Project->new($data->{'project'}, $self);
+}
+
+=back
+
+=head2 WWW::Freshmeat::Project methods
+
+The C<WWW::Freshmeat::Project> object provides some of the fields from the
+freshmeat.net entry through the following methods
+
+=over 4
+
+=item B<url_project_page>
+
+=item B<url_homepage>
+
+=item B<projectname_full>
+
+=item B<desc_short>
+
+=item B<desc_full>
+
+=item B<license>
+
+=item B<www_freshmeat>
+
+=back
+
+Additionnally, it provides the following "higher-level" methods:
+
+=over 4
+
+=item B<name>
+
+=item B<description>
+
+Return either C<projectname_full> (respectively C<desc_full>) or
+C<projectname_short> (respectively C<desc_short>) if the former is empty.
+
+=item B<version>
+
+Returns the version of the latest release.
+
+=item B<url>
+
+C<url_homepage> returns a freshmeat.net URL that redirects to the actual
+project's home page. This url() method tries to follow the redirection and
+returns the actual homepage URL if it can be found, or the URL to the
+freshmeat.net entry for the project.
+
+=back
+
+=head1 SEE ALSO
+
+L<LWP::UserAgent>.
+
+=head1 AUTHOR
+
+Cedric Bouvier, C<< <cbouvi at cpan.org> >>
+
+=head1 BUGS
+
+This is very alpha code. It does not even support searching!
+
+Please report any bugs or feature requests to
+C<bug-www-freshmeat at rt.cpan.org>, or through the web interface at
+L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Freshmeat>.
+I will be notified, and then you'll automatically be notified of progress on
+your bug as I make changes.
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+    perldoc WWW::Freshmeat
+
+You can also look for information at:
+
+=over 4
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/WWW-Freshmeat>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/WWW-Freshmeat>
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Freshmeat>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/WWW-Freshmeat>
+
+=back
+
+=head1 ACKNOWLEDGEMENTS
+
+=head1 COPYRIGHT & LICENSE
+
+Copyright 2006 Cedric Bouvier, all rights reserved.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+1; # End of WWW::Freshmeat

Added: packages/libwww-freshmeat-perl/branches/upstream/current/t/00-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-freshmeat-perl/branches/upstream/current/t/00-load.t?rev=3804&op=file
==============================================================================
--- packages/libwww-freshmeat-perl/branches/upstream/current/t/00-load.t (added)
+++ packages/libwww-freshmeat-perl/branches/upstream/current/t/00-load.t Thu Sep 14 23:00:49 2006
@@ -1,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+	use_ok( 'WWW::Freshmeat' );
+}
+
+diag( "Testing WWW::Freshmeat $WWW::Freshmeat::VERSION, Perl $], $^X" );

Added: packages/libwww-freshmeat-perl/branches/upstream/current/t/boilerplate.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-freshmeat-perl/branches/upstream/current/t/boilerplate.t?rev=3804&op=file
==============================================================================
--- packages/libwww-freshmeat-perl/branches/upstream/current/t/boilerplate.t (added)
+++ packages/libwww-freshmeat-perl/branches/upstream/current/t/boilerplate.t Thu Sep 14 23:00:49 2006
@@ -1,0 +1,48 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+sub not_in_file_ok {
+    my ($filename, %regex) = @_;
+    open my $fh, "<", $filename
+        or die "couldn't open $filename for reading: $!";
+
+    my %violated;
+
+    while (my $line = <$fh>) {
+        while (my ($desc, $regex) = each %regex) {
+            if ($line =~ $regex) {
+                push @{$violated{$desc}||=[]}, $.;
+            }
+        }
+    }
+
+    if (%violated) {
+        fail("$filename contains boilerplate text");
+        diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
+    } else {
+        pass("$filename contains no boilerplate text");
+    }
+}
+
+not_in_file_ok(README =>
+    "The README is used..."       => qr/The README is used/,
+    "'version information here'"  => qr/to provide version information/,
+);
+
+not_in_file_ok(Changes =>
+    "placeholder date/time"       => qr(Date/time)
+);
+
+sub module_boilerplate_ok {
+    my ($module) = @_;
+    not_in_file_ok($module =>
+        'the great new $MODULENAME'   => qr/ - The great new /,
+        'boilerplate description'     => qr/Quick summary of what the module/,
+        'stub function definition'    => qr/function[12]/,
+    );
+}
+
+module_boilerplate_ok('lib/WWW/Freshmeat.pm');

Added: packages/libwww-freshmeat-perl/branches/upstream/current/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-freshmeat-perl/branches/upstream/current/t/pod-coverage.t?rev=3804&op=file
==============================================================================
--- packages/libwww-freshmeat-perl/branches/upstream/current/t/pod-coverage.t (added)
+++ packages/libwww-freshmeat-perl/branches/upstream/current/t/pod-coverage.t Thu Sep 14 23:00:49 2006
@@ -1,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();

Added: packages/libwww-freshmeat-perl/branches/upstream/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libwww-freshmeat-perl/branches/upstream/current/t/pod.t?rev=3804&op=file
==============================================================================
--- packages/libwww-freshmeat-perl/branches/upstream/current/t/pod.t (added)
+++ packages/libwww-freshmeat-perl/branches/upstream/current/t/pod.t Thu Sep 14 23:00:49 2006
@@ -1,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();




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