Buffers...the solution to end all.

I have a web engine that I wrote...and I do error pages in much the same manner that you want to do your "wait" page. The trick is to gather ALL the content of the page prior to printing it out.

What I would do is put everything into some sort of buffer in this manner:

# assume this is a snippet from a fully functional, declared, stricted + script my $buffer; $buffer .= "content\n<br>\n"; #or for long sets: $buffer .= <<END Content <br> More content <br> END
Then I have a subroutine to print the code. So my main script looks like this (very simplified):

#!/usr/bin/perl -t use strict; include subroutines.pl; # I always put my subs for webapps in one pla +ce...and not in the main script. my $header = getheader(); my $footer = getfooter(); my $content = getcontent(); # This is where you'd run a bunch of chec +ks to see what you actually need print $header; print $content; print $footer; #eof

Now obviously...if you need to do a "waiting" screen much like you do...you'll need to use a meta tag to set the refresh. that will need to go into the header. So somehow figure out a way for the getheader() subroutine to check if it needs a refresh, and then refresh it.

Hope that helps.

--Coplan


In reply to Re: displaying output at the correct moment by Coplan
in thread displaying output at the correct moment by jcpunk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.