I'm having some issues with some web code I'm writing. It's supposed to print the values that the user input, then do some processing (the printout is just to verify to the user that it got the data, so they don't think the sometimes-long-wait means that it's locked up).
Here's some of the relevant code:
$| = 1;
select(STDERR); $| = 1;
select(STDOUT); $| = 1;
print <<END_HTML;
Content-type: text/html
\n\n
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<head>
END_HTML
#reads the input values here
print END_HTML;
<title>PAGE TITLE</title>
<!--OTHER HTML HEADER STUFF-->
</head>
<body>
<!--VISIBLE PAGE HEADINGS AND STUFF-->
END_HTML
print "value: $value<br>";
# the above line is repeated for each input value
open(temp_handle, "> log_file");
print(temp_handle "log stuff"); #repeated with information
close temp_handle;
system("external_program");
# the above program can take several seconds to several
# minutes to run
print <<END_HTML;
</BODY>
</HTML>
END_HTML
What happens is that it displays on the client everything up to and including the "visible page headers" stuff, but none of the values. However, when I set $| = 0 for the STDOUT one, it prints everything and then does the processing.
Am I misunderstanding how $| works?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|