NAME
POE::Component::SmokeBox::Recent - A POE component to retrieve recent
CPAN uploads.
SYNOPSIS
use strict;
use POE qw(Component::SmokeBox::Recent);
$|=1;
POE::Session->create(
package_states => [
'main' => [qw(_start recent)],
],
);
$poe_kernel->run();
exit 0;
sub _start {
POE::Component::SmokeBox::Recent->recent(
url => 'http://www.cpan.org/',
event => 'recent',
);
return;
}
sub recent {
my $hashref = $_[ARG0];
if ( $hashref->{error} ) {
print $hashref->{error}, "\n";
return;
}
print $_, "\n" for @{ $hashref->{recent} };
return;
}
DESCRIPTION
POE::Component::SmokeBox::Recent is a POE component for retrieving
recently uploaded CPAN distributions from the CPAN mirror of your
choice.
It accepts a url and an event name and attempts to download and parse
the RECENT file from that given url.
It is part of the SmokeBox toolkit for building CPAN Smoke testing
frameworks.
CONSTRUCTOR
recent
Takes a number of parameters:
'url', the full url of the CPAN mirror to retrieve the RECENT file from, only http ftp and file are currently supported, mandatory;
'event', the event handler in your session where the result should be sent, mandatory;
'session', optional if the poco is spawned from within another session;
'context', anything you like that'll fit in a scalar, a ref for instance;
'rss', set to a 'true' value to retrieve from the rss file instead of RECENT file.
'epoch', an epoch timestamp less than the current time but greater than an year ago.
The 'session' parameter is only required if you wish the output
event to go to a different session than the calling session, or if
you have spawned the poco outside of a session.
The 'rss' parameter if set will indicate that the poco should
retrieve recent uploads from the "modules/01modules.mtime.rss" file
instead of the "RECENT" file. The rss file contains the 150 most
recent uploads to CPAN and is more up to date than the "RECENT"
file.
The 'epoch' parameter should be a valid epoch timestamp less than
the current time but greater than a year ago. Setting this will
cause the component to use CPAN::Recent::Uploads to obtain a list of
distributions uploaded since the 'epoch' time given. This enables
more grandular control of listing dists than simply retrieving the
"RECENT" file.
The poco does it's work and will return the output event with the
result.
OUTPUT EVENT
This is generated by the poco. ARG0 will be a hash reference with the
following keys:
'recent', an arrayref containing recently uploaded distributions;
'error', if something went wrong this will contain some hopefully meaningful error messages;
'context', if you supplied a context in the constructor it will be returned here;
AUTHOR
Chris "BinGOs" Williams <chris@bingosnet.co.uk>
LICENSE
Copyright © Chris Williams
This module may be used, modified, and distributed under the same terms
as Perl 5 itself. Please see the license that came with your Perl 5
distribution for details.
KUDOS
Andy Armstrong for helping me to debug accessing his CPAN mirror.
SEE ALSO
POE
<http://cpantest.grango.org/>
POE::Component::Client::HTTP
POE::Component::Client::FTP