in reply to Extracting Pages via proxy server using WWW::Mechanize

I've used the following solution before, which extends mechanize. I'm pretty sure I found this on perlmonks, but I can't find the original node, apologies to the monk i'm ripping off :)
#!/usr/bin/perl -w my $mech = WWW::MechanizeCustom->new(); $mech->proxy('http','http://your-proxy:80'); $mech->set_basic_credentials( 'username', 'password' ); $mech->get("http://perlmonks.com"); print $mech->content; #================================================================ package WWW::MechanizeCustom; use base 'WWW::Mechanize'; # add a set_basic_credentials method, using a closure to remember { my ( $username, $password ); sub set_basic_credentials{ ( $username, $password ) = @_[1..2] } sub get_basic_credentials{ $username, $password }; }
---
my name's not Keith, and I'm not reasonable.