in reply to Re^2: Better Solution To WWW::Mechanize Basic Authentication
in thread Better Solution To WWW::Mechanize Basic Authentication
Note: vastly simplified.
package MyUA; use base 'LWP::UserAgent'; { my $user; my $pass; sub set_creds { $user = shift; $pass = shift; } sub get_basic_credentials { ($user, $pass) } }
get_basic_credentials() is called by the GET/POST/FOO methods when challenged (perhaps more often, you may need to verify this). I use it to read passwords from a config file, prompt from a terminal w/o echoing, and other times that I need to access restricted sites.
Update: credentials(), afaict, takes 4 parameters, not two. Perhaps that is the root of the reason it isn't working. Reached for my favorite hammer when a screwdriver was already provided.
Update 2: Per almut in Re^4: Better Solution To WWW::Mechanize Basic Authentication, I stand corrected. Two parameter version is quite correct.
--MidLifeXis
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Better Solution To WWW::Mechanize Basic Authentication
by almut (Canon) on Oct 19, 2009 at 16:52 UTC | |
by MidLifeXis (Monsignor) on Oct 19, 2009 at 17:04 UTC | |
|
Re^4: Better Solution To WWW::Mechanize Basic Authentication
by Limbic~Region (Chancellor) on Oct 19, 2009 at 17:14 UTC | |
by MidLifeXis (Monsignor) on Oct 19, 2009 at 17:45 UTC |