I have successfully setup my CGI::Applications so that a single app
module can be run under 3 different environments - mod_cgi instance
script, ModPerl::Registry and an Apache PerlResponseHandler, under both
Linux and WinXP OS's on a dual-boot development system. Firstly, is
there any practical reason why this 3-way arrangement should not be done
on a production (or even development) system?
Anyway, it seems to work well provided I set the handler method to call
a separate Handler.pm module, which then 'uses' my main app module. As I
should be able to dispense with the Handler module and put the handler
directly into the main module, I used the scheme outlined in
http://www.mail-archive.com/cgiapp@xxxxxxxxxxxx/msg00486.html.
But as I understand it, the 'sub handler ($$)' method is not available
to mod_perl 2.0, and doesn't work anyway, so I substituted the mod_perl2
'sub handler : method' as follows:
sub handler : method {
my ($class, $r) = @_;
my $self = $class->new(
PARAMS => {
't0' => [gettimeofday],
# app_url changes according to whether called via mod_cgi, mp
registry or mp handler
'app_url' => 'http://127.0.0.1/hilis',
}
);
$class->run();
return Apache::OK;
}
This has no adverse effect when called via mod_cgi or MP:Registry
(presumably they ignore it), but gives the following error when called
via a Perl handler:
[error] [client 127.0.0.1] Can't use string ("HILIS4") as a HASH ref
while "strict refs" in use at
/usr/lib/perl5/site_perl/5.8.7/CGI/Application.pm line 449.\n
HILIS4 is the name of my app module. Line 449 of Application.pm reads:
unless (exists($self->{__QUERY_OBJ})) {
Also getting this error:
-e: Odd number of elements in anonymous hash at
/usr/lib/perl5/site_perl/5.8.7/CGI/Application/Plugin/AnyTemplate/Base.pm
line 85.
Perhaps these errors are connected? As far as I can tell the handler :
method block is correct. Any ideas? Hope this is not too confusing.
--
Richard Jones
Leeds, UK
mailto:ra.jones@xxxxxxxxxxxxxxx
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/cgiapp@xxxxxxxxxxxxxxxxx/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: cgiapp-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: cgiapp-help@xxxxxxxxxxxxxxxxx
|