Thread View: fj.lang.perl
1 messages
1 total messages
Started by stevenf
Tue, 28 Apr 1998 00:00
Problem with Perl script (Probaply very simple)
Author: stevenf
Date: Tue, 28 Apr 1998 00:00
Date: Tue, 28 Apr 1998 00:00
80 lines
2952 bytes
2952 bytes
I everyone!
Check out this HTMLcode.
<html>
<form action=/cgi-bin/print.cgi method=get>
Text1 <input type=text name=text1 size=40><br>
Text2 <input type=text name=text2 size=40><br>
Text3 <input type=text name=text3 size=40><br>
<input type=submit value="Make Document">
</form>
</html>
Now I use this Perl script to make a new document with the text just entered.
#!/usr/local/bin/perl
&parse_form_data (*form);
print "Content-type: text/html\n\n";
print <<End_of_document;
<html>
Text1: $form{'text1'}<br>
Text2: $form{'text2'}<br>
Text3: $form{'text3'}<br>
</html>
End_of_document
exit ();
sub parse_form_data
{
local (*FORM_DATA) = @_;
local ( $request_method, $query_string, @key_value_pairs,
$key_value, $key, $value);
$request_method = $ENV{'REQUEST_METHOD'};
if ($request_method eq "GET") {
$query_string = $ENV{'QUERY_STRING'};
} elsif ($request_method eq "POST") {
read (STDIN, $query_string, $ENV{'CONTENT_LENGTH'});
} else {
&return_error (500, "Server Error",
"Server uses unsupported method");
}
@key_value_pairs = split (/&/, $query_string);
foreach $key_value (@key_value_pairs) {
($key, $value) = split (/=/, $key_value);
$value =~ tr/+/ /;
$value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
if (defined($FORM_DATA{$key})) {
$FORM_DATA{$key} = join ("\0", $FORM_DATA{$key}, $value);
} else {
$FORM_DATA{$key} = $value;
}
}
}
The problem is that I'm getting an : Internal Server Error 500
This line : #!/usr/local/bin/perl is correct!
The personal that made this says it works and I believe him because when I run
it on my workstation it runs correct. But when I upload it onto the server
where the script should run it doesn't work! :(
The Perl version they are using is : Perl 5.003
You can see what it does at : http://www.ekstein.nl/print.html
Can somebody please please help me because I really really need this script to
work.
If possible could you please send your answer to my emailaddress, because I
can't get the newsgroup here at my work! My emailaddress :
stevenf@pcdynamics.nl
Thank you very very much!
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads