CGI script: redirect a page, then redirect to *another* page.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bunkle
    New Member
    • Mar 2008
    • 1

    #1

    CGI script: redirect a page, then redirect to *another* page.

    Okay, Here's what I want to do.

    I want to write a cgi-script that does something that takes a while to run. While it does that something, it displays content to a page. When it's done doing that something, it loads a new page.

    For example:

    ----------
    Code:
    $| = 1; #autoflush so the output with go "live" to the page.
    
    print "Content-type: text/html\n\n";
    print "<h1>Let's count to 100!</h1>\n";
    for ($i = 1; $i <= 100; $i++){
         select(undef, undef, undef, .25);#sleep 1/4 second between lines
         print "<b>$i !!!</b><br>\n";
    }
    select(undef,undef,undef, 1);
    print "<h1>Yeah!!</h1>";
    select(undef, undef, undef, 2);
    
    // a bunch of magic perl code I don't know how to do that will kill the current 
    response, and set up a new response and reset STDOUT as though
    nothing has been passed yet. //
    
    print "Content-type: text/html\n\n";
    print "<h1>Wasn't that fun!</h1>";
    ----------------------------------------------------
    If I knew the magic perl, this would:

    Display a page that will take 25 seconds to display the numbers 1 to 100 (1/4 second per number) and *then* loads a "new" html page, that says "Wasn't that fun?"

    Without the magic perl this, of course, displays the page that takes 25 to "count" to 100, Then prints "Content-type: text/html" and "Wasn't that fun" at the bottom of the page.

    Anyone know how/if I can kill STDOUT and "start anew"?
Working...