Hello,

Help me please.
I have got so far with trying to build this script (little knowledge) and
have got a problem trying to read from a form

<form action="http://yes/cgi-bin/metacheck/read_html5.cgi"; method="POST">
the field on the form being <input type="text" name="url" width="15"
maxlength="50" size="50">

When I run the script I get :-

CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:

Global symbol "%FORM" requires explicit package name at
C:\Inetpub\wwwroot\cgi-bin\metacheck\read_html5.cgi line 23.
Global symbol "%FORM" requires explicit package name at
C:\Inetpub\wwwroot\cgi-bin\metacheck\read_html5.cgi line 25.
BEGIN not safe after errors--compilation aborted at
C:\Inetpub\wwwroot\cgi-bin\metacheck\read_html5.cgi line 36.


I have tried so many combinations of 'my' with the $FORM variable.

Thanks in advance.
Malcolm

use CGI; # Use the CGI.pm module
use strict;
LWP::Useragent;

my
($url,$name,$value,$buffer,$pair,$pairs,$html,$meta,$lockit,$lines,@metas,@l
ines,@pairs);
my $q = new CGI;
##############################
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

# Split the name-value pairs
@pairs = split(/&/, $buffer);

foreach $pair (@pairs) {
   ($name, $value) = split(/=/, $pair);

   $value =~ tr/+/ /;
   $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
   $value =~ s/<([^>]|\n)*>//g;
   $value =~ s/<//g;
   $value =~ s/>//g;
   $FORM{$name} = $value; #line 21
}
 $url = $FORM{'url'};   #line 23
####################################
#THIS OPENS THE HTML FILE

use LWP;
my $pagecontent;

my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new('GET', $url);
my $response = $ua->request($request);

if ( $response->is_success()){
  $pagecontent = $response->content() ;
}else {
  my $rc = $response->code();
  die "Error Occured with response code $rc";
}
# Read everything in file to $meta
{ local $/;
   $html = <HTML>;
}
close HTML;


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to