[cgiapp] CAP::AutoRunmode not working with mod_perl again ??

Richard Jones ra.jones at dpw.clara.co.uk
Fri Nov 7 08:44:40 EST 2008


I know this was supposed to be fixed in v0.14 but it seems to be 
happening again. In a trivial setup:

########################################
package My::CGIApp;

use base 'CGI::Application';
use CGI::Application::Plugin::AutoRunmode;

sub my_start_run_mode : StartRunmode {
    my $self = shift;
    return $self->dump_html;
}

sub mode2 : Runmode {
    my $self = shift;
    return $self->dump_html;
}

1;
#######################################

######################################################
[perl.conf]
PerlModule My::CGIApp
<location /cgiapp>
  SetHandler perl-script
  PerlResponseHandler "sub { My::CGIApp->new()->run(); return OK; }"
</location>

PerlModule ModPerl::Registry
Alias /perl/ /home/raj/perl/
<Location /perl>
  SetHandler perl-script
  PerlResponseHandler ModPerl::Registry
  #PerlOptions +ParseHeaders
  #PerlOptions -GlobalRequest
  Options +ExecCGI
</Location>
#######################################################

#######################################
# /home/raj/perl/cgiapp.pl:
use lib '/home/raj/myapp';

use My::CGIApp;
my $webapp = My::CGIApp->new();
$webapp->run();
#######################################

Request http://localhost/perl/cgiapp.pl (ie ModPerl::Registry) = "No 
such run mode 'my_start_run_mode' at /home/raj/perl/cgiapp.pl line 7"

Request http://localhost/cgiapp (ie handler) = "No such run mode 
'my_start_run_mode' at (eval 960) line 1"

So in both cases the system can load the target My::CGIApp module and 
identify the StartRunmode, yet then declares 'no such runmode'!

What's really weird is that I can put CGIApp.pm in the same directory as 
the registry instance script (cgiapp.pl) and re-point cgiapp.pl to the 
new location and I get the $self->dump_html output, but it incorrectly 
states Current Run-mode: 'start', and it cannot find 
http://localhost/perl/cgiapp.pl?rm=mode2 (No such run mode 'mode2'), so 
I don't think that's working properly either.

Previously I had an old app running fine as a mod_perl handler script 
using CAP::AutoRunmode on a PCLinuxOS 2007 server, then re-built the 
server with a different OS (Ubuntu 8.04), and straight away I got the 
"no such runmode foo" error. So I assumed I had mis-configured mod_perl 
and just switched over to mod_cgi and left it for a rainy day. It makes 
me wonder whether something broke with a version change in some Perl 
package, Apache2, mod_perl2, etc.

Currently using Apache/2.2.4 (Ubuntu) mod_fastcgi/2.4.2 mod_perl/2.0.2 
Perl/v5.8.8. CGI::Application is v4.11 and CAP::AutoRunmode is v0.15. Is 
this the same pre-0.14 mod_perl bug? It would be really useful if 
someone can confirm they *do* have AutoRunmode working under 
Apache2/mod_perl2, either as handler or registry, and if so how their 
setup differs from mine.
--
Richard Jones


More information about the cgiapp mailing list