summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Fredric <kentfredric@gmail.com>2012-01-06 19:03:38 +1300
committerKent Fredric <kentfredric@gmail.com>2012-01-06 19:03:38 +1300
commit35b9a8c3d05650d4023e7b61ded134314f1f498d (patch)
tree523e60e279f7de0a81bb9381efc1db1b9778d191 /scripts/lib
parentMojoX::Renderer::TT (diff)
downloadperl-overlay-35b9a8c3d05650d4023e7b61ded134314f1f498d.tar.gz
perl-overlay-35b9a8c3d05650d4023e7b61ded134314f1f498d.tar.bz2
perl-overlay-35b9a8c3d05650d4023e7b61ded134314f1f498d.zip
[scripts] optimise package query, fix end-point to _search, add debug options in the WWW layer
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/metacpan.pm19
1 files changed, 15 insertions, 4 deletions
diff --git a/scripts/lib/metacpan.pm b/scripts/lib/metacpan.pm
index 58ce0f26e..702a2a962 100644
--- a/scripts/lib/metacpan.pm
+++ b/scripts/lib/metacpan.pm
@@ -20,11 +20,22 @@ sub mcpan {
root_dir => File::Spec->catdir( File::Spec->tmpdir, 'gentoo-metacpan-cache' ),
);
require WWW::Mechanize::Cached;
- my $mech = WWW::Mechanize::Cached->new(
- cache => $cache,
- timeout => 20000,
+ my $mech;
+
+ if ( defined $ENV{WWW_MECH_NOCACHE} ) {
+ $mech = LWP::UserAgent->new();
+ } else {
+ $mech = WWW::Mechanize::Cached->new(
+ cache => $cache,
+ timeout => 20000,
autocheck => 1,
- );
+ );
+ }
+ if ( defined $ENV{WWW_MECH_DEBUG} ) {
+ $mech->add_handler("request_send", sub { warn shift->dump ; return });
+ $mech->add_handler("response_done", sub { warn shift->dump ; return });
+
+ }
require HTTP::Tiny::Mech;
my $tinymech = HTTP::Tiny::Mech->new( mechua => $mech );
require MetaCPAN::API;