|
|
| We don't bite newbies here... much | |
| PerlMonks |
perlman:CGI::Pushby root (Scribe) |
| on Dec 23, 1999 at 00:50 UTC ( #1169=perlfunc: print w/ replies, xml ) | Need Help?? |
CGI::PushSee the current Perl documentation for CGI::Push. Here is our local, out-dated (pre-5.6) version: ![]() CGI::Push - Simple Interface to Server Push
![]()
use CGI::Push qw(:standard);
do_push(-next_page=>\&next_page,
-last_page=>\&last_page,
-delay=>0.5);
sub next_page {
my($q,$counter) = @_;
retur
Heterogeneous Pages
Ordinarily all pages displayed by CGI::Push share a common
MIME type. However by providing a value of ``heterogeneous'' or ``dynamic'' in the
If you use this option, you will be responsible for producing the HTTP header for each page. Simply modify your draw routine to look like this:
sub my_draw_routine {
my($q,$counter) = @_;
return header('text/html'), # note we're producing the header here
start_html('testing'),
h1('testing'),
"This page called $counter times";
}
You can add any header fields that you like, but some (cookies and status fields included) may not be interpreted by the browser. One interesting effect is to display a series of pages, then, after the last page, to redirect the browser to a new
URL. Because
sub my_draw_routine {
my($q,$counter) = @_;
return undef if $counter > 10;
return header('text/html'), # note we're producing the header here
start_html('testing'),
h1('testing'),
"This page called $counter times";
}
sub my_last_page {
header(-refresh=>'5; URL=finished',
-type=>'text/html'),
start_html('Moved'),
h1('This is the last page'),
'Goodbye!'
hr,
end_html;
}
Changing the Page Delay on the Fly
If you would like to control the delay between pages on a page-by-page basis, call
INSTALLING CGI::Push SCRIPTSServer push scripts must be installed as no-parsed-header (NPH) scripts in order to work correctly. On Unix systems, this is most often accomplished by prefixing the script's name with ``nph-''. Recognition of NPH scripts happens automatically with WebSTAR and Microsoft IIS. Users of other servers should see their documentation for help.
CAVEATSThis is a new module. It hasn't been extensively tested.
AUTHOR INFORMATIONbe used and modified freely, but I do request that this copyright notice remain attached to the file. You may modify this module as you wish, but if you redistribute a modified version, please attach a note listing the modifications you have made. Address bug reports and comments to: lstein@genome.wi.mit.edu
BUGSThis section intentionally left blank.
SEE ALSO |
|