Mercurial > rlmcintyre
diff BoosterPack/scripts/.svn/text-base/pjx_NO_CACHE_caller.pl.svn-base @ 0:0d795f02a8bb tip
initial committ. what was I thinking?
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 27 Sep 2010 16:57:26 -0400 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/BoosterPack/scripts/.svn/text-base/pjx_NO_CACHE_caller.pl.svn-base Mon Sep 27 16:57:26 2010 -0400 1.3 @@ -0,0 +1,46 @@ 1.4 +#!C:/strawberry/perl/bin/perl.exe 1.5 + 1.6 +# this is an script calls an external script and avoids caching: 1.7 +# NB The CGI::Ajax object must come AFTER the coderefs are declared. 1.8 + 1.9 +use strict; 1.10 +use CGI::Ajax; 1.11 +use CGI; 1.12 + 1.13 +my $q = new CGI; 1.14 + 1.15 +my $Show_Form = sub { 1.16 + my $html = ""; 1.17 + $html .= <<EOT; 1.18 +<HTML><title>CGI::Ajax No_Cache Example</title> 1.19 +<HEAD> 1.20 +</HEAD> 1.21 +<BODY> 1.22 +<i> 1.23 +If the same URL is requested, A browser may cache the result 1.24 +and return it without querying the requested URL. To avoid that, use 1.25 +the 'NO_CACHE' keyword as a parameter in your javascript function. 1.26 +</i><br/> 1.27 +<form> 1.28 +Click the button and a perl script 'pjx_NO_CACHE_callee.pl should 1.29 +return the current time:<br/><br/> 1.30 + 1.31 +<input type="button" id="b1" size="6" value='This will cache (in IE)' onclick="perl_script([], ['out1']);return false"><br/> 1.32 + 1.33 +<input type="button" id="b2" size="6" value='This will NOT cache' onclick="perl_script(['NO_CACHE'], ['out1']);"><br/> 1.34 + 1.35 +New Time:<input type=text id="out1"> 1.36 + 1.37 + 1.38 +</form> 1.39 +</BODY> 1.40 +</HTML> 1.41 +EOT 1.42 + 1.43 + return $html; 1.44 +}; 1.45 + 1.46 +my $pjx = CGI::Ajax->new( 'perl_script' => 'pjx_NO_CACHE_callee.pl'); 1.47 +$pjx->JSDEBUG(1); 1.48 +$pjx->DEBUG(1); 1.49 +print $pjx->build_html($q,$Show_Form); # this outputs the html for the page