The catch is that you always have to return something,
even if that something is "nothing". Some sites feature
a waiting page which refreshes frequently, waiting on output
from something. It might feature a pleasant animated GIF,
and hopefully not something along the lines of
WAIT
with the horrific <BLINK> tag.
A quick way of doing this is to create script A which,
when run the first time will fork off script B, and then
refresh to itself with a special parameter. Script B
will write to a certain filename in /tmp, for example,
and script A, when called, will check for this file. When
this file is there, script A prints it, possibly deletes
it, and stops refreshing. The name of the file is encoded
in the special parameter. If, for example, the parameter
"_" was set to "fZdaPXzAQ", then you would be waiting for
the file "/tmp/fZdaPXzAQ.out". The choice of name is
arbitrary.
There are a couple of things you will want to note:
- You might want to write a separate program to clean
out any stale /tmp entries instead of leaving this up to
script A. This way the user can reload the page and still
get output, without you having to process all over again.
- Your script B should not write directly to the /tmp
file, but should create a preliminary version which it
writes to, then renames it at the end to the proper name.
This will prevent script A from jumping the gun and printing
when script B has only written half its output.
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.