Where did you assign a value to $req? (I suspect it should have been
assigned from the POST call since POST returns a request object.)
--
Mac :})
** I may forward private database questions to the DBI mail lists. **
----- Original Message -----
From: "Nick Chirca" <[EMAIL PROTECTED]>
To: "Pramod Sokke" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, July 24, 2000 5:37 PM
Subject: Re: where's the catch ?
>
> I just tried to do what you suggested. You are right about that -w option,
> but althought I declared "my $req", I still get :
> "Can't call method "method" on an undefined value at
> /usr/lib/perl5/site_perl/5.005/LWP/UserAgent.pm line 163.
> "
> It seems that it's impossible to me to make POST method work; and it
> would be of great help if I could do that, because I am trying to build
> scripts that fill in forms and handle responses....
>
> Nick...
>
> > This is a fundamental Perl problem. Since you've started using "-w", it
> > tries to catch all undeclared, un-initialised, potential global
variables.
> > In this case, $req is not defined explicitly as a local, hence this
error.
> > Just add 'my $req' in this script before you use $req and things should
> > work fine.
> > Let me know if you have any other problems.
> >
> > -Pramod
> >
> > At 04:53 PM 7/22/00 -0200, you wrote:
> > >
> > >#! /usr/bin/perl -w
> > >use LWP::UserAgent;
> > >use HTTP::Cookies;
> > >use HTTP::Request::Common qw(POST);
> > >$ua = LWP::UserAgent->new;
> > >$ua->cookie_jar(HTTP::Cookies->new(file => "lwpcookies.txt",
> > > autosave => 1));
> > >POST 'http://login.yahoo.com',
> > > [login=>'nick_chirca',
> > > passwd=>'mypassword',
> > > ];
> > >my $res = $ua->request($req);
> > > print $res->as_string;
> > >
> > >
> > >But I get this:
> > >"Name "main::req" used only once: possible typo at post1 line 12.
> > >Can't call method "method" on an undefined value at
> > >/usr/lib/perl5/site_perl/5.005/LWP/UserAgent.pm line 163. "
> > >
> > >
> > >Can anyone tell me how to actually be able to login into my yahoo
account
> > >with LWP/POST ?