Subject: | CGI::Ajax problems with mod_perl 1.31 |
Using mod_perl 1.31 on Apache 1.3.41
<Files *.mpl>
SetHandler perl-script
PerlHandler Apache::Registry
Options +ExecCGI
allow from all
</Files>
if i use the attached ajax.pl (in regular perl mode) all reports normally.
if i use the attached ajax.pl in mod_perl mode, random times the $param
result in the perl_func sub is undefined (because all of $q->param is
empty). cannot replicate without CGI::Ajax.
Subject: | ajax.pl |
use strict;
use CGI qw(:standard -nosticky);
use CGI::Ajax;
my $q = CGI->new;
my $pjx = new CGI::Ajax( 'exported_func' => \&perl_func );
print $pjx->build_html( $q, \&Show_HTML, { -expires => 'now' } );
sub perl_func {
my $input = shift;
my $param;
foreach my $key ($q->param){
if($key =~ /^\d+$/){
if($q->param($key) == $input){
$param = $key;
last;
}
}
}
my $output = "set value for [$param] to [$input]";
return( $output );
}
sub Show_HTML {
my $html = <<EOHTML;
<HTML>
<BODY>
123: <select name="123" id="123" onchange="exported_func( ['123'], ['result'] );">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<br>
567: <select name="567" id="567" onchange="exported_func( ['567'], ['result'] );">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<br>
<br>
<div id="result"></div>
</BODY>
</HTML>
EOHTML
return $html;
}