App-CPAN-Fresh
view release on metacpan or search on metacpan
lib/App/CPAN/Fresh.pm view on Meta::CPAN
my $info = $self->parse_entry($entry->{body}, $entry->{date}) or next;
printf "%s-%s (%s)\n", $info->{dist}, $info->{version}, $info->{author};
}
}
sub parse_entry {
my($self, $body, $date) = @_;
my $time = Time::Piece->strptime($date, "%Y-%m-%dT%H:%M:%SZ") or return;
if (time - $time->epoch > $duration) {
# entry found, but it's old
return;
}
if ($body =~ /^([\w\-]+) (v?[0-9\._]*(?:-TRIAL)?) by (.+?) - <a.*href="(http:.*?\.tar\.gz)"/) {
return {
dist => $1,
version => $2,
author => $3,
url => $4,
};
}
return;
}
sub new_ua {
my $self = shift;
LWP::UserAgent->new(agent => "cpanf/$VERSION", env_proxy => 1);
}
sub call {
my($self, $method, $opts) = @_;
my $uri = URI->new("http://friendfeed-api.com/v2$method");
$uri->query_form(%$opts) if $opts;
my $ua = $self->new_ua;
my $res = $ua->get($uri);
if ($res->is_error) {
croak "HTTP error: ", $res->status_line;
}
JSON::decode_json($res->content);
}
1;
__END__
=encoding utf-8
=for stopwords
=head1 NAME
App::CPAN::Fresh - Query and install CPAN modules realtime from the fresh mirror
=head1 DEPRECATION
B<This module does not work anymore since FriendFeed has been shutdown.> You can use C<cpanm>'s C<--metacpan> option to enable MetaCPAN API search which can give you recently updated module in almost realtime. There's also C<--dev> option which allow...
=head1 DESCRIPTION
App::CPAN::Fresh is a backend for I<cpanf> command.
=head1 AUTHOR
Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt>
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
L<cpanf>
=cut
( run in 1.067 second using v1.01-cache-2.11-cpan-39bf76dae61 )