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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.