NAME

WWW::CPANRatings::RSS - get information from RSS feed on http://cpanratings.perl.org/

SYNOPSIS

use strict;
use warnings;

use WWW::CPANRatings::RSS;

my $rate = WWW::CPANRatings::RSS->new;

$rate->fetch
    or die $rate->error;

for ( @{ $rate->ratings } ) {
    printf "%s - %s stars - by %s\n--- %s ---\nsee %s\n\n\n",
        @$_{ qw/dist rating creator comment link/ };
}


WWW-Google-Video - 2 stars - by Zoffix Znet
--- The module doesn't do any error checking when using get() from LWP::Simple which causes warnings to be printed due to subsequent regex matches done on ... ---
see http://cpanratings.perl.org/#4478

String-String - 1 stars - by BKB
--- A completely pointless module, it consists of exactly one line of code, and a hundred lines of documentation. I don't know why anyone would need to do ... ---
see http://cpanratings.perl.org/#4476

# ... and so on...

DESCRIPTION

The module provides access to information provided by RSS feed on http://cpanratings.perl.org/, which is basically several of most recent reviews.

CONSTRUCTOR

new

my $rate = WWW::CPANRatings::RSS->new;

my $rate = WWW::CPANRatings::RSS->new(
    ua => {
        agent   => 'Foo',
        timeout => 30,
    },
);

Returns a freshly baked WWW::CPANRatings::RSS object. Arguments are passed in a key/value fashion. So far there is only one argument ua.

ua

->new(
    ua => {
        agent   => 'Foo',
        timeout => 30,
    },
);

Optional. Takes a hashref as a value. This hashref will be directly dereferenced into LWP::UserAgent object used by this module. For possible arguments see LWP::UserAgent documentation. Defaults to: { timeout => 30 }

METHODS

fetch

my $ratings = $rate->fetch
    or die $rate->error;

Takes no arguments. Instructs the object to fetch the RSS feed on http://cpanratings.perl.org/. On success returns an arrayref of hashrefs, which are described below. On failure returns either undef or an empty list, depending on the context, in which case the error() method will return the explanation of the error. The elements (hashrefs) in the returned arrayref represent cpanratings reviews, in reverse-chronological order (i.e. newest first). The format of each hashref is as follows:

$VAR1 = {
      'link' => 'http://cpanratings.perl.org/#4446',
      'comment' => 'This module has failed on all swf\'s ive tried it on.  All attempts at transcoding has resulted in contentless flv that will not play.
',
      'creator' => 'Dave Williams',
      'dist' => 'FLV-Info',
      'rating' => '1'
};
{ 'link' => 'http://cpanratings.perl.org/#4446', }

The link key will contain a string which represents a link to the review.

comment

{ 'comment' => 'This module has failed on all swf\'s ive tried it on.  All attempts at transcoding has resulted in contentless flv that will not play. }

The comment key will contain a string representing the (often partial, starting from the beginning) content of the review.

creator

{ 'creator' => 'Dave Williams', }

The creator key will contain a string which represents the name of the person who created the review.

dist

{ 'dist' => 'FLV-Info', }

The dist key will contain a string which is the name of the distribution that was reviewed.

rating

{ 'rating' => '1' }

{ 'rating' => 'N/A' }

The rating key will contain the rating of the distribution given by the creator of the review. It will either be the number of "stars" or 'N/A' if no rating was given.

error

my $ratings = $rate->fetch
    or die $rate->error;

In case of an error during the call to fetch() method, the error method will return a string which describes the reason for failure.

ratings

$rate->fetch
    or die $rate->error;

my $ratings = $rate->ratings;

Must be called after a successful call to fetch() method. Returns the exact same arrayref as the last call to fetch() returned;

ua

my $ua_obj = $rate->ua;

$rate->ua( LWP::UserAgent->new );

Returns an LWP::UserAgent object used internally for fetching the RSS feed. When called with an optional argument, which must be an LWP::UserAgent or a compatible object, will use the provided object in any subsequent calls to fetch() method.

PREREQUISITES

For healthy operation this module needs XML::Simple and LWP::UserAgent

EXAMPLES

The examples/ directory of this distributing contains a script presented in the SYNOPSYS section.

AUTHOR

Zoffix Znet, <zoffix at cpan.org> (http://zoffix.com, http://haslayout.net)

BUGS

Please report any bugs or feature requests to bug-www-cpanratings-rss at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-CPANRatings-RSS. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc WWW::CPANRatings::RSS

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2008 Zoffix Znet, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.