Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: CGI - Keep'em quiet page?

by nysus (Parson)
on Jun 16, 2001 at 20:52 UTC ( #89068=note: print w/replies, xml ) Need Help??


in reply to CGI - Keep'em quiet page?

I think I may have a more elegant solution for you:
#!/usr/bin/perl -w use strict; $|++; BEGIN{ use CGI qw(:standard); print header; print start_html; print "Please wait"; print end_html; } sleep 5; # Code that process form would actually go here require Perl_file_that_redirects_browser_goes_here.pl; # Above line simply calls a Perl file that uses CGI.pm "redirect" func +tion to redirect the browser to the desired page.

This is untested but I don't see a reason why it wouldn't work.

Update: After some testing, this isn't working because the redirect gets printed to the HTML page instead of redirecting the browser because it is called after the content header. I naively assumed using calling another script with "require" would solve this problem but it doesn't. Anyone else have any ideas on how to redirect the browser?

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot";
$nysus = $PM . $MCF;

Replies are listed 'Best First'.
Re: Re: CGI - Keep'em quiet page?
by koolade (Pilgrim) on Jun 16, 2001 at 21:38 UTC

    Above line simply calls a Perl file that uses CGI.pm "redirect" function to redirect the browser to the desired page.

    That won't work because CGI.pm's redirect() prints out HTTP headers to redirect the client. But you've already printed out HTTP headers, so the redirect headers will be included in the text rendered by the browser. So the user will see:

    Please wait
    Status: 302 Moved
    location: http://path/to/redirect

    If you'll want to redirect in that manner you'll have to use JavaScript.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://89068]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2022-09-28 16:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (124 votes). Check out past polls.

    Notices?