Re: Not able to use LWP::UserAgent::Authenticated



"HP" <hirendra_a@xxxxxxxxxxxxxx> wrote:

> my $ua = LWP::UserAgent::Authenticated->new( $LOGINID, $PASSWORD );
>
> its giving me error

Couldn't find this module on CPAN

> i have installed the LWP

Doesn't seem to be part of LWP.

> please help me out

my $req = HTTP::Request->new( GET => "http://....."; );
$req->authorization_basic( "user", "password" );

works for me.

See also perldoc lwpcook
"
ACCESS TO PROTECTED DOCUMENTS

Documents protected by basic authorization can easily be accessed like
this:

use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$req = HTTP::Request->new(GET => 'http://www.linpro.no/secret/');
$req->authorization_basic('aas', 'mypassword');
print $ua->request($req)->as_string;

The other alternative is to provide a subclass of LWP::UserAgent that
overrides the get_basic_credentials() method. Study the lwp-request
program for an example of this."

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
I ploink googlegroups.com :-)

.



Relevant Pages

  • Re: Alternate to installing via CPAN?
    ... CPAN modules aren't distributed as ... this kind of configuration, and Perl modules rely on it. ... LWP not available ... E.g. with 'o conf urllist push ...
    (perl.beginners)
  • DBIx::Migration::Directories version 0.07 failing tests
    ... Fetching with LWP: ... CPAN: Digest::SHA loaded ok ... User to connect to the database as ...
    (comp.lang.perl.modules)
  • perlmagick install trouble on sol 10 sparc
    ... cpan shell -- CPAN exploration and modules installation ... ReadLine support available (try 'install Bundle::CPAN') ... LWP not available ... Fetching with Net::FTP: ...
    (SunManagers)
  • LWP install MacOS X
    ... Download LWP. ... install in a new place. ... I've checked the perl and CPAN FAQs. ...
    (comp.lang.perl.misc)
  • CPAN help
    ... CPAN: LWP::UserAgent loaded ok ... Fetching with LWP: ... No external ftp command available ...
    (perl.beginners)