Send two documents to browser? - repost

This is a repost of an earlier question as I don't think I made the
problem explicit enough, or highlighted the dependence on a perl based
solution.

I have a commercial perl search engine script that is slow in
producing results. As a consequence, once the user presses the search
button he/she has to stare at a glaring white blank screen until the
results are returned. I would like the script to send a temporary
document to the browser until the search is complete and then replace
this document with the search results.

It has been suggested in earlier replies that I use an interstitial
page and browser redirects to achieve this but I don't see how this
will work as if the script returns a temporary page which then
redirects, where will it redirect to? If it calls the script again
then we are no further forward.

The search engine is part of a complex shopping basket and we have
neither the expertise or the budget to make major changes to the
application. What I am hoping to find is a perl solution that I can
insert at the start of the search script that will send out the
temporary page while still allowing the script to do the searches and
then replace the temporary page with its results. We thought we had
solved the problem but instead of the search results replacing the
temporary page they were added below the temporary page, causing
essential header information to be printed rather than being
interpreted by the browser.

I have heard that perl TK is able to return yes/no pop ups whilst
still allowing the script to run in the background. Does anyone know
if perl TK could produce the required temporary document?

Is there any way I could fork to a process that would send the
temporary document yet still allow the search script to replace this
document once it is completed?

Many thanks for your interest, any information is gratefully received.

Mark

The previious post.
> Hi All,
>
> I have a commercial website search script which is slow in returning
> its results. The consequence is that for a short period the screen is
> white until the results are returned.
>
> Is there a simple way to make the script return a temporary document
> to the browser which is then replaced by the search results?
>

Yes, there are simple ways to do this. However, they are no more
Perl-specific than they are Cobol-specific. Rather than give you a
whole
solution here (and encourage more non-Perl-specific questions,
drowning
out those with Perl questions), I'll mention "interstitial pages",
"browser redirects", and point you toward Google and the
comp.infosystems.www.authoring.cgi newsgroup.

Advertisements

It was a dark and stormy night, and Mark managed to scribble:
> Hi All,
>
> This is a repost of an earlier question as I don't think I made the
> problem explicit enough, or highlighted the dependence on a perl based
> solution.
>
> I have a commercial perl search engine script that is slow in
> producing results. As a consequence, once the user presses the search
> button he/she has to stare at a glaring white blank screen until the
> results are returned. I would like the script to send a temporary
> document to the browser until the search is complete and then replace
> this document with the search results.
>
> It has been suggested in earlier replies that I use an interstitial
> page and browser redirects to achieve this but I don't see how this
> will work as if the script returns a temporary page which then
> redirects, where will it redirect to? If it calls the script again
> then we are no further forward.
>

Advertisements

Mark (tiscaliX.co.uk) wrote:
>Hi All,
>
>This is a repost of an earlier question as I don't think I made the
>problem explicit enough, or highlighted the dependence on a perl based
>solution.
>
>I have a commercial perl search engine script that is slow in
>producing results. As a consequence, once the user presses the search
>button he/she has to stare at a glaring white blank screen until the
>results are returned. I would like the script to send a temporary
>document to the browser until the search is complete and then replace
>this document with the search results.
>

You might want to use Javascript to do that. For example, the following script
mycgiscript.pl will generate an input form for the search, when the form is
submitted it will create a popup window telling the user that the search is in
progress - meanwhile your script can continue process the search results, when
done the popup window will close.

.... or if you do not want to use Javascript, you might want to try this:

#!/usr/bin/perl

use strict;

print "Content-Type: text/html

<html><head><title>Time intensive task</title><head><body>
<h3><font size=6 color=red>This task will take a long long time...</font></h3>
Go have a cup of coffee while you're waiting.<p>
<h3>Please do not close or use this window while the task is in
progress.</h3>";
for my $ix(0..4000) { print " " } # fill the browser's buffer so that it will
be flushed
#
#
sleep(10); # do your processing...
#
#
print "<h2>DONE!</h2>Now you may use this window again.";

The above script will simply force the browser to flush its buffer so that the
user will not need to look at a blank screen.

In article <>,
Mark <> wrote:
> > Hi All,
> >
> > I have a commercial website search script which is slow in returning
> > its results. The consequence is that for a short period the screen is
> > white until the results are returned.
> >
> > Is there a simple way to make the script return a temporary document
> > to the browser which is then replaced by the search results?
> >
>
> Yes, there are simple ways to do this. However, they are no more
> Perl-specific than they are Cobol-specific. Rather than give you a
> whole
> solution here (and encourage more non-Perl-specific questions,
> drowning
> out those with Perl questions), I'll mention "interstitial pages",
> "browser redirects", and point you toward Google and the
> comp.infosystems.www.authoring.cgi newsgroup.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!