Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

How to replace the output (new html page)?

by Gary Yang (Acolyte)
on Jan 18, 2012 at 22:41 UTC ( #948639=perlquestion: print w/replies, xml ) Need Help??
Gary Yang has asked for the wisdom of the Perl Monks concerning the following question:

I do not know if this is a Perl or html question. Please help.
My Perl script runs at Server Site. When the script gets called, it outputs (prints) a progress html page displayed at Client site. When the program ends, it generates a new html page. This new html page should replace that progress page. However, instead of replacing the ProgressPage, the new html page is appended to ProgressPage. I use Perl here doc to print html pages. Below is the sample code.

First, print Progress Page.

Print <<ProgressPage; <html> <head> .. </head> <body> .. </body> </html> ProgressPage

Then, print the new HTML page. I want the new HTML page (NewPage) replaces ProgressPage. But, instead of replacing it, NewPage appends to ProgressPage. Can someone tell me how to replace ProgressPage with NewPage?

print <<NewPage; <html> <head> </head> <body> </body> </html> NewPage

Replies are listed 'Best First'.
Re: How to replace the output (new html page)?
by Anonymous Monk on Jan 19, 2012 at 04:04 UTC
Re: How to replace the output (new html page)?
by Anonymous Monk on Jan 19, 2012 at 11:24 UTC

    You are searching for some kind of server push with HTTP. It can be done -- look at a Bugzilla's after-search "munching bugs" screen.

    I'm not familiar with it, but I suspect it is a case of sending two files with "Content-Disposition: inline" and some sort of MIME splitting to distinguish the two HTML pages. Try to find out more by reading the Bugzilla source.

      As the other Anon hinted at, server push technology (originally introduced by Netscape -- yes, it's that old) appears not to work in MSIE, but the other major browsers seem to handle it fine.

      An alternative solution would be to save your second HTML page (temporarily?) to a publicly-accessible place, and redirect/link there once you are done. Some strategically placed output flushing might work best there (but might also be broken by a change of your web server or CGI serving configuration).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://948639]
Approved by ww
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2018-06-18 08:06 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (109 votes). Check out past polls.