|
I've downloaded and installed HTTP::Request::Form module
(version 0.7)
(also installed libwww-perl-5.48, URI-1.06, MIME-Base64-2.11, HTML-Parser-3.07, libnet-1.0703, Digest-MD5-2.09, HTTP::Request::Common, HTML::TreeBuilder, LWP::UserAgent) and tried to test the module with the example source in the
man page.
#!/usr/local/bin/perl
use HTML::TreeBuilder; use URI::URL; use LWP::UserAgent; use HTTP::Request; use HTTP::Request::Common; use HTTP::Request::Form; my $ua =
LWP::UserAgent->new;
my $url = url 'http://www.altavista.com/'; my $res = $ua->request(GET $url); my $tb = HTML::TreeBuilder->new; $tb->parse($res->content); my @forms = @{$tb->extract_links(qw(FORM))}; my $f = HTTP::Request::Form->new($forms[0][1], $url); $f->field("q", "perl"); my $response = $ua->request($f->press("search")); print $response->content if ($response->is_success); When I run the example code above, I encountered the problem
as below.
Can't call method "traverse" on an
undefined value
at /usr/local/lib/perl5/site_perl/5.6.0/HTTP/Request/Form.pm line 120. Any help clearing this matter up would be greatly
appreciated.
|
