cobra has asked for the wisdom of the Perl Monks concerning the following question:
But get the following error on running the script:#!/user/local/bin/perl use strict; use CGI; use HTTP::Request; use LWP::UserAgent; use HTTP::Header; my $start_town = "Guildford"; my $destination_town = "Portsmouth"; my $ua = LWP::UserAgent->new(); my $method = "POST"; my $url = "http://212.87.65.227/bin/query.exe/en"; my $header = HTTP::Header->new(); my $content = "to=".$start_town."&from=".$destination_town; my $request = HTTP::Request->new($method, $url, $header, $content); use HTTP::Response; my $response = $ua->request($request, "page.html"); if($response->is_success) { open PLEASE, "<page.html"; while (<PLEASE>) { print; } close PLEASE; } else { print $response->error_as_HTML; }
From this I assumed that the Web server I am using does not have the Header.pm module. So I tried removing the header line and using the following code:Can't locate HTTP/Header.pm in @INC (@INC contains: /opt/PDperl/5005_0 +3/lib/5.00 503/sun4-solaris-thread /opt/PDperl/5005_03/lib/5.00503 /opt/PDperl/50 +05_03/lib/ site_perl/5.005/sun4-solaris-thread /opt/PDperl/5005_03/lib/site_perl/ +5.005 .) a t tester3.cgi line 7. BEGIN failed--compilation aborted at tester3.cgi line 7.
But got the following error:#!/user/local/bin/perl use strict; use CGI; use HTTP::Request; use LWP::UserAgent; #use HTTP::Header; my $start_town = "Guildford"; my $destination_town = "Portsmouth"; my $ua = LWP::UserAgent->new(); my $method = "POST"; my $url = "http://212.87.65.227/bin/query.exe/en"; #my $header = HTTP::Header->new(); my $content = "to=".$start_town."&from=".$destination_town; my $request = HTTP::Request->new($method, $url, [$content]); use HTTP::Response; my $response = $ua->request($request, "page.html"); if($response->is_success) { open PLEASE, "<page.html"; while (<PLEASE>) { print; } close PLEASE; } else { print $response->error_as_HTML;
What is blessing and what variable do I need to bless? Or am I on the wrong track? Any help would be gratefully appreciated. CobraCan't call method "clone" on unblessed reference at /opt/PDperl/5005_0 +3/lib/site _perl/5.005/HTTP/Message.pm line 53.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Submitting information to an online form
by merlyn (Sage) on Apr 25, 2001 at 17:37 UTC | |
|
Re: Submitting information to an online form
by arturo (Vicar) on Apr 25, 2001 at 17:13 UTC | |
by arturo (Vicar) on Apr 25, 2001 at 17:26 UTC | |
by merlyn (Sage) on Apr 25, 2001 at 17:49 UTC | |
|
Re: Submitting information to an online form
by diarmuid (Beadle) on Apr 25, 2001 at 20:09 UTC |