[Chicago-talk] WWW::Mechanize and http basic auth?

Greg Fast gdf at speakeasy.net
Mon May 30 08:10:35 PDT 2005


Hey, what's the correct way to do HTTP basic auth with WWW::Mechanize?
The perldoc contains a section on the credentials() method copied from
LWP::UserAgent's perldoc, but it doesn't seem to work (read: I can't
figure out what the arguments are supposed to be).

The LWP cookbook has this:

  my $req = HTTP::Request->new( GET => $uri );
  $req->authentication_basic( $user, $pass );
  $ua->request( $req );

Which works for Mech, but seems a little complicated, especially given
the "why are you using this?" comment in Mech's perldoc for
request().

Am I missing something?  Should I work up a patch to add a simpler method?

-- 
Greg Fast
gdf at speakeasy.net
http://cken.chi.groogroo.com/


More information about the Chicago-talk mailing list