/usr/share/doc/libcgi-ajax-perl/examples/CGI-Application-Ajax-ex01.pl is in libcgi-ajax-perl 0.707-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #! /usr/bin/perl -w
use strict;
package main ;
my $tester = new Tester ;
$tester->run ;
package Tester ;
use base qw(CGI::Application);
use CGI::Ajax;
sub setup {
my $self = shift;
$self->run_modes([qw(
start
)]);
}
sub Show_HTML {
my $html = <<EOT;
<html>
<head><title>CGI::Ajax Example</title>
</head>
<body>
<form>
Enter Something:
<input type="text" name="val1" id="val1" size="6" onkeyup="jsfunc( ['val1'], 'result' ); return true;"><br>
Enter Something:
<hr>
<div id="result" style="border: 1px solid black;
width: 440px; height: 80px; overflow: auto">
</div>
</form>
</body>
</html>
EOT
}
sub calc {
my $input = shift;
return "got input: $input " ;
}
sub start {
my $self = shift;
my $pjx = new CGI::Ajax( 'jsfunc' => \&calc );
$pjx->JSDEBUG(2);
my $text = $pjx->build_html($self,\&Show_HTML );
return $text ;
}
|