CONSTRUCTOR

new

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:

fetch_unique

In case of an error will return either undef or an empty list and the error message will be available via error() method. The fetch_unique method is the same as fetch method and returns the arrayref in the same format. The difference is that fetch_unique will read/store any reviews that it were already reported and will only return the ones that haven't been reported yet. You can use this method to implement "new cpan ratings" announcements. Takes one optional argument which is a scalar containing the name of the file into which to store the already reported reviews which is the same file from which the module will attempt to read already reported reviews. The argument will defaul to'cpan_ratings.rss.storable' if not specified.

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;

ratings_unique

Must be called after a successful call to fetch_unique() method. Returns the exact same arrayref as the last call to fetch_unique() method 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.

As a valued partner and proud supporter of MetaCPAN, StickerYou is
happy to offer a 10% discount on all Custom Stickers,
Business Labels, Roll Labels,
Vinyl Lettering or Custom Decals. StickerYou.com
is your one-stop shop to make your business stick.
Use code METACPAN10 at checkout to apply your discount.