Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (22 sloc) 0.936 kb
name 'cpanidx';
description 'query CPAN IDX rather than scraping search.cpan.org';
author 'Tatsuhiko Miyagawa';
api_version 0.1;
# This is a proof-of-concept plugin:
# DO NOT USE THIS PLUGIN - the server hardcoded here is not frequently updated
hook search_module => sub {
my $args = shift;
return unless $args->{module} =~ /^[A-Za-z0-9_:]+$/;
push @{$args->{uris}}, sub {
require YAML;
$args->{app}->chat("Querying CPANIDX for $args->{module}\n");
my $yaml = $args->{app}->get("http://cpanidx.bingosnet.co.uk/cpandb/yaml/mod/$args->{module}");
my $meta = (YAML::Load($yaml))[0];
if (my $d = $meta->[0]) {
$args->{app}->chat("Got a response from CPANIDX => $d->{dist_file}\n");
return $args->{app}->cpan_uri($d->{dist_file});
}
$args->{app}->chat("! Finding $args->{module} on cpanidx failed.\n");
return;
};
};
Jump to Line
Something went wrong with that request. Please try again.