Mercurial > boosterpack
annotate scripts/pjx_change_headers.pl @ 9:9652dc713ba6 boosterpack
working on adding to rlmcintyre.com
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 26 Jun 2010 20:06:08 -0400 |
parents | 477258d09353 |
children |
rev | line source |
---|---|
robert@0 | 1 #!C:/strawberry/perl/bin/perl.exe |
robert@0 | 2 |
robert@0 | 3 use strict; |
robert@0 | 4 use CGI::Ajax; |
robert@0 | 5 use CGI; |
robert@0 | 6 |
robert@0 | 7 my $func = sub { |
robert@0 | 8 my $input = shift; |
robert@0 | 9 return "got input: $input " ; |
robert@0 | 10 }; |
robert@0 | 11 |
robert@0 | 12 |
robert@0 | 13 sub Show_HTML { |
robert@0 | 14 my $html = <<EOT; |
robert@0 | 15 |
robert@0 | 16 <html> |
robert@0 | 17 <head><title>CGI::Ajax Example</title> |
robert@0 | 18 |
robert@0 | 19 </head> |
robert@0 | 20 <body> |
robert@0 | 21 <form> |
robert@0 | 22 Enter Something: |
robert@0 | 23 <input type="text" name="val1" id="val1" size="6" onkeyup="jsfunc( ['val1'], 'result' ); return true;"><br> |
robert@0 | 24 Enter Something: |
robert@0 | 25 <hr> |
robert@0 | 26 <div id="result" style="border: 1px solid black; |
robert@0 | 27 width: 440px; height: 80px; overflow: auto"> |
robert@0 | 28 </div> |
robert@0 | 29 |
robert@0 | 30 </form> |
robert@0 | 31 </body> |
robert@0 | 32 </html> |
robert@0 | 33 |
robert@0 | 34 EOT |
robert@0 | 35 |
robert@0 | 36 } |
robert@0 | 37 |
robert@0 | 38 my $cgi = new CGI(); # create a new CGI object |
robert@0 | 39 my $pjx = new CGI::Ajax( 'jsfunc' => $func ); |
robert@0 | 40 # the send in some extra headers; |
robert@0 | 41 print $pjx->build_html($cgi,\&Show_HTML, { '-expires' => '1d', '-charset' => 'ISO-8859-1'} ); |