On Tue, 16 Jul 2002, David Gerler wrote:

> I am getting the following error from Perl builder:
> Can't call method "click" on an undefined value at next_attempt.pl line 52.
> 
> Here's my code so far:
> 
> 
> BEGIN CODE________________________________________________________
> #!/usr/local/bin/perl
> 
> use strict;
> use HTTP::Request::Common;
> use HTML::Form;
> use LWP::UserAgent;
> #use LWP::Debug qw(+);
> use HTTP::Cookies;
> use FileHandle;
> 
> $url = 'https://www.ubid.com/app/mypage/default.asp?';
> $pass = "";
> $login = "";
> BEGIN
> {
>     local $^W = 0;
>     *LWP::UserAgent::redirect_ok = sub {1}
> }
> $headers = HTTP::Headers->new();
> 
> $headers->header(
>    'User-Agent' => 'Mozilla/4.76 [en] (Win98; U)',
>    'Accept-Language' => 'en-US',
>    'Accept-Charset' => 'iso-8859-1,*,utf-8',
>    'Accept-Encoding' => 'gzip',
>    'Accept' =>
>     "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, image/png, */*",
> );
> 
> my $ua = LWP::UserAgent->new();
> 
> $ua->cookie_jar(
>   HTTP::Cookies->new( autosave => 1 ));
> #, $headers
> 
> my $req = HTTP::Request->new(GET => $url);
> print $req->as_string();
> 
> my $response = $ua->request($req);
> 
> print $response->as_string();
> 
since you are using $form->click() you can see that 
$form is *reference* not array .
so do:
 my $form = HTML::Form->parse( $response->content, $response->base());
> my @form = HTML::Form->parse( $response->content, $response->base());
> $a = 0;
> #while ($form[$a]){
> #     print "form $a\n";
> #     print $form[$a]->dump;
> #     $a++;
> #}
> 
> $form[3]->value( 'LOGIN',   "$login" );
> $form[3]->value( 'PASSWORD', "$pass" );
> 
> my $response = $ua->request( $form->click(Go) );
> 
> 
> END CODE______________________________________________________________
> 
> 
> This is the form that It is processing:
> printed with "print $form[$a]->dump;"
> 
> BEGIN FORM DATA ___________________________________________________
> POST https://www.ubid.com/app/mypage/default.asp?
>   LOGIN=value
>   PASSWORD=value                  (password) 
>   LOGINBTN=Go                     (submit)  
>   TIMES_SUBMITTED=1               (hidden)  
>   submitcount=0                   (hidden)  
>   DispWelcome=1                   (hidden)  
> 
> END FORM DATA________________________________________________________
> 
> 
> Can somebody point me in the direction to fix this?
> 
> Thanks.
> 
> 
> David Gerler
> Gerler Enterprises
> PO BOX 16357
> Chesapeake VA 23328
> http://www.GerlerEnterprises.com/
> 
> Nationwide Dial-up from $12.45
> http://www.EasySitesForLess.com/ 
> 

-- 
-------------------------------------------
If You don't like my English - I can use Russian.
Evgeny.

Reply via email to