HP3000-L Archives

July 1997, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
John Korb <[log in to unmask]>
Reply To:
John Korb <[log in to unmask]>
Date:
Fri, 25 Jul 1997 10:36:16 -0400
Content-Type:
TEXT/PLAIN
Parts/Attachments:
TEXT/PLAIN (68 lines)
I'm trying to use Perl with the NCSA Web Server and having some problems
with STDIN.  Unfortunately, I'm also a novice at Perl.

I have a simple Perl script which works when executed directly from the
shell (with input terminated by ":EOD"), but which hangs (apparently
waiting on more input) when run from the web server.  The Perl script is
very close to one in the Perl book I'm using and is included below.

#!/usr/local/bin/perl
#
#  Test script to copy from STDIN to a file named TEMPHOLD.
#
$server=$ENV{'SERVER_SOFTWARE'};
print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n";
print "Server: $server\n\n";
print "<HTML>\n";
print "<head>\n";
print "<title>\n";
print "Display STDIN Contents\n";
print "</title>\n";
print "</head>\n";
print "<body bgcolor=#FFFFFF>\n";
print "<h1>STDIN Contents</h1>\n";
print "Contents of STDIN will be written to /WWW/TEMP/TEMPHOLD.\n";
open (OUTFILE, ">/WWW/TEMP/TEMPHOLD");
while (<STDIN>) {
        print OUTFILE;
        }
close OUTFILE;
print "TEMPHOLD has been closed.\n";
print "</body>\n";
print "</html>\n";
exit(0);

The server error log shows that when the user eventually gives up and
clicks "STOP" on the browser, the following two errors are reported:

[Fri Jul 25 08:56:58 1997] killing CGI process 7602373
[Fri Jul 25 08:57:01 1997] httpd: send timed out for korbj

Nothing unusual there.

When I check the /WWW/TEMP/TEMPHOLD file, it contains all of the data it
should (form contents in this case).

QUESTION:
It appears that the Perl "while (<STDIN>)" test is not seeing an
end-of-file on STDIN when it reaches the end of the data submitted by the
form, but from the examples in the Perl and CGI books it appears that in
"normal UNIX" implementations the above "while" SHOULD be seeing an
end-of-file.

Is this an implementation issue related to MPE/iX 5.5, or the NCSA server
on 5.5, or am I misunderstanding the Perl and CGI books?

Any ideas?

Thanks!

John
--------------------------------------------------------------
John Korb                            email: [log in to unmask]
Innovative Software Solutions, Inc.

The thoughts, comments, and opinions expressed herein are mine
and do not reflect those of my employer(s), or anyone else.

ATOM RSS1 RSS2