H
Hon Guin Lee - Web Producer - SMI Marketing
Hi,
I am having problems with the following code, in which the get() function from the LWP::Simple is not
retrieving any of the contents of the web page from the specified URL location on the associated web form.
From the following code, it only outputs "Ok" on the web browser.
The web browser I am currently using is Netscape version 4.79, and using Perl version 5.6.1, although the @INC
points to Perl version 5.0.5 on the local web server which I am placing the html, and cgi files on.
The question is that shouldn't print $page place the HTML content of the specified URL on the web browser, and
in my case why doesn't this occur? This also relates all the similar functions within the LWP::Simple module
such as getprint(), getstore(), and head().
When I place the -w switch onto the perl interpreter initial line code, the following warnings are shown and
the perl script doesn't compile and displays a server error on the web browser.
---------------------------------------------------------------------
Unquoted string "lang" may clash with future reserved word at automation1.cgi line 26.
Content-type: text/html
Use of uninitialized value in concatenation (.) or string at automation1.cgi line 25.
Use of uninitialized value in pattern match (m//) at /usr/local/perl5.6/lib/site_perl/5.6.1/LWP/Simple.pm line
292.
Use of uninitialized value in print at automation1.cgi line 47.
---------------------------------------------------------------------
If any one has a solution to this problem, reply back.
---------------------------------------------------------------------
#!/usr/local/perl5.6/bin/perl
# perl script to get remote
# urls and strip them and
# upload them to teamsite
use LWP::Simple qw(!head);
use CGI qwstandard); # then only CGI.pm defines a head()
my ($url, $lang, $page);
$query = new CGI;
print "Content-type: text/html\n\n";
process_form();
get_url($url);
# Passes the data from the server,
# and takes them onto the PERL script.
sub process_form {
$url = $query->param(url);
$url = "http://" . $url;
$lang = $query->param(lang);
}
# Retrieves the contents of the
# specified URL.
sub get_url {
$page = get ($_);
if ($page = undef) {
print "Couldn't retrieve $url";
}
else {
print "Ok";
print $page;
}
}
---------------------------------------------------------------------
I am having problems with the following code, in which the get() function from the LWP::Simple is not
retrieving any of the contents of the web page from the specified URL location on the associated web form.
From the following code, it only outputs "Ok" on the web browser.
The web browser I am currently using is Netscape version 4.79, and using Perl version 5.6.1, although the @INC
points to Perl version 5.0.5 on the local web server which I am placing the html, and cgi files on.
The question is that shouldn't print $page place the HTML content of the specified URL on the web browser, and
in my case why doesn't this occur? This also relates all the similar functions within the LWP::Simple module
such as getprint(), getstore(), and head().
When I place the -w switch onto the perl interpreter initial line code, the following warnings are shown and
the perl script doesn't compile and displays a server error on the web browser.
---------------------------------------------------------------------
Unquoted string "lang" may clash with future reserved word at automation1.cgi line 26.
Content-type: text/html
Use of uninitialized value in concatenation (.) or string at automation1.cgi line 25.
Use of uninitialized value in pattern match (m//) at /usr/local/perl5.6/lib/site_perl/5.6.1/LWP/Simple.pm line
292.
Use of uninitialized value in print at automation1.cgi line 47.
---------------------------------------------------------------------
If any one has a solution to this problem, reply back.
---------------------------------------------------------------------
#!/usr/local/perl5.6/bin/perl
# perl script to get remote
# urls and strip them and
# upload them to teamsite
use LWP::Simple qw(!head);
use CGI qwstandard); # then only CGI.pm defines a head()
my ($url, $lang, $page);
$query = new CGI;
print "Content-type: text/html\n\n";
process_form();
get_url($url);
# Passes the data from the server,
# and takes them onto the PERL script.
sub process_form {
$url = $query->param(url);
$url = "http://" . $url;
$lang = $query->param(lang);
}
# Retrieves the contents of the
# specified URL.
sub get_url {
$page = get ($_);
if ($page = undef) {
print "Couldn't retrieve $url";
}
else {
print "Ok";
print $page;
}
}
---------------------------------------------------------------------