NAME
WWW::PAUSE::RecentUploads - get the list of the recent uploads to PAUSE
SYNOPSIS
use strict;
use warnings;
use WWW::PAUSE::RecentUploads;
my $pause = WWW::PAUSE::RecentUploads->new(
login => 'LOGIN', # mandatory
pass => 'pass-o-word', # also mandatory
ua_args => { timeout => 10, }, # optional args to LWP::UserAgent
);
my $data = $pause->get_recent
or die "Failed to fetch data: " . $pause->error;
foreach my $dist ( @$data ) {
print "$dist->{dist} by $dist->{name} (size: $dist->{size})\n";
}
DESCRIPTION
Fetch the list of recent uploads on http://pause.perl.org and retrieve the dist's name, author's name and dist's size.
CONSTRUCTOR
new
my $pause = WWW::PAUSE::RecentUploads->new(
login => 'LOGIN', # mandatory
pass => 'pass-o-word', # also mandatory
ua_args => { timeout => 10, }, # optional args to LWP::UserAgent
);
Returns a WWW::PAUSE::RecentUploads object. Takes two mandatory and one optional arguments:
login
->new( login => 'YOUR_PAUSE_LOGIN' );
Mandatory. Module requires you to have an account on http://pause.perl.org. The login
argument's value must be your PAUSE login.
pass
->new( pass => 'secret_pass-o-word' );
Mandatory. Module requires you to have an account on http://pause.perl.org. The pass
argument's value must be your PAUSE password.
ua_args
->new(
ua_args => {
timeout => 10,
agent => 'PauseGrabber3000',
# the rest of LWP::UserAgent options can go here.
},
);
Optional. Using ua_args
argument you may specify arguments to pass on to LWP::UserAgent constructor. Note: by default LWP::UserAgent object is constructed with its default options with the exception of the timeout
argument which is set to 30
seconds.
METHODS
get_recent
my $data = $pause->get_recent
or die "Failed to fetch data: " . $pause->error;
Takes no arguments. Returns an arrayref or undef
in case of an error. If an error occured the content of it will be available via error()
method (see below). If succeeded returns an arrayref of hashrefs. Each of those hashref will contain three keys, which are as follows:
name
{ 'name' => 'ZOFFIX', }
The name
key will contain the name, or rather a PAUSE ID of the upload author.
dist
{ 'dist' => 'POE-Component-WebService-Validator-HTML-W3C-0.04' }
The dist
key will contain the name of the distro.
size
{ 'size' => '11467b' }
The size
key will contain the size of the distro. Note that this won't be "just a number" it will also be postfixed with a unit (which, probably will not always be b
for bytes).
error
my $data = $pause->get_recent
or die "Failed to fetch data: " . $pause->error;
If an error occured during fetching of data, the get_recent()
method (see above) will return undef
and you will be able to get sensible error with error()
method.
ACCESSORS/MUTATORS
login
my $current_login = $pause->login;
$pause->login( 'new_login' );
Take zero or one argument which is the PAUSE login (see login
argument for the constructor). Returns currently set login (which will be the argument if you provided one).
pass
my $current_pass = $pause->pass;
$pause->pass( 'new_pass0rwords' );
Take zero or one argument which is the PAUSE password (see pass
argument for the constructor). Returns currently set password (which will be the argument if you provided one).
ua_args
my $current_ua_args = $pause->ua_args;
$pause->ua_args( {
timeout => 60,
agent => 'Unknown',
# other LWP::UserAgent arguments can go here
}
);
Takes zero or one argument which must be a hashref of options to pass to LWP::UserAgent constructor (see ua_args
argument for the constructor as well as documentation for LWP::UserAgent). Returns currently set arguments (which will be the argument if you provided one).
BE HUMAN
PAUSE is a free service from which we all benifit and by means of which you are even reading this text. Please do not abuse it.
SEE ALSO
LWP::UserAgent, http://pause.perl.org
BUGS AND CAVEATS
No bugs known so far. Note that if the upload doesn't have a name of the author it will not be present in the results. This is not a bug, names usually appear a bit later than the dist name which is the reason for this.
PREREQUISITES
This module requires: Carp, LWP::UserAgent, HTML::TokeParser::Simple and URI modules as well as Test::More module for make test
AUTHOR
Zoffix Znet, <zoffix at cpan.org>
(http://zoffix.com, http://haslayout.net)
BUGS
Please report any bugs or feature requests to bug-www-pause-recentuploads at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-PAUSE-RecentUploads. 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::PAUSE::RecentUploads
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-PAUSE-RecentUploads
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
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.