🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fj.lang.perl
Article #146

Problem with Perl script (Probaply very simple)

#146
From: stevenf
Date: Tue, 28 Apr 1998 00:00
80 lines
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
Technical Details
Message-ID: <6i48rf$ere$1@nnrp1.dejanews.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1043e7,26773173d1d8b98a,start
X-Google-Attributes: gid1043e7,public
From: stevenf@pcdynamics.nl
Subject: Problem with Perl script (Probaply very simple)
Date: 1998/04/28
Message-ID: <6i48rf$ere$1@nnrp1.dejanews.com>
X-Deja-AN: 348355243
X-Http-User-Agent: Mozilla/4.04 [en] (Win95; I ;Nav)
Organization: Deja News - The Leader in Internet Discussion
X-Article-Creation-Date: Tue Apr 28 09:51:44 1998 GMT
Newsgroups: fj.lang.perl