[cgiapp] testing the new CAD::PSGI version

Ron Savage ron at savage.net.au
Thu May 19 19:53:09 EDT 2011


Hi Mark

Another attempt. More below.

On Thu, 2011-05-19 at 11:26 +1000, Ron Savage wrote:
> Hi Mark
> 
> Doesn't work for me.
> 
> I assume it's due to the exact combination of modules used and their
> parentage.
> 
> (1) 1 line change to Local::Application::Controller:
> 
> package Local::Application::Controller;
> 
> #Patch#use parent 'CGI::Application';
> use parent 'CGI::Application::Dispatch::PSGI';
> use strict;
> use warnings;
> ...
> 
> (2) 2 line change to app.psgi:
> 
> #!/usr/bin/env perl
> #
> # Run with:
> # starman -l 127.0.0.1:5002 --workers 1 httpd/cgi-bin/local/app.psgi &
> # or, for more debug output:
> # plackup -l 127.0.0.1:5002 httpd/cgi-bin/local/app.psgi &
> 
> use strict;
> use warnings;
> 
> #Patch#use CGI::Application::Dispatch::PSGI;
> use Local::Application::Controller;
> 
> use Plack::Builder;
> 
> # ---------------------
> 
> #Patch#my($app) = CGI::Application::Dispatch -> as_psgi
> my($app) = Local::Application::Controller -> as_psgi
> (
> 	prefix => 'Local::Application::Controller',
> 	table  =>
> 	[
> 	''              => {app => 'Initialize', rm => 'display'},
> 	':app'          => {rm => 'display'},
> 	':app/:rm/:id?' => {},
> 	],
> );
> 
> builder
> {
> 	enable "Plack::Middleware::Static",
> 	path => qr!^/(assets|favicon|yui)/!,
> 	root => '/dev/shm/html';
> 	$app;
> };
> 
> (3) The error:
> 
> [Dispatch] ERROR: Unknown error: Can't locate object method "new" via
> package "Local::Application::Controller::Initialize"
> at /home/ron/perl5/perlbrew/perls/perl-5.12.2/lib/site_perl/5.12.2/CGI/Application/Dispatch/PSGI.pm line 455.
> 
> This'll be because CGI::Application itself is not pulled in.

(4) 1 line change to Local::Application::Controller (multiple
inheritance):

package Local::Application::Controller;

#Patch#use parent 'CGI::Application';
use parent qw/CGI Application CGI::Application::Dispatch::PSGI/;
use strict;
use warnings;
...

(5) The error:

[Dispatch] ERROR: Unknown error: Can't locate object method
"run_as_psgi" via package "Local::Application::Controller::Initialize"
at /home/ron/perl5/perlbrew/perls/perl-5.12.2/lib/site_perl/5.12.2/CGI/Application/Dispatch/PSGI.pm line 465.

-- 
Ron Savage
http://savage.net.au/
Ph: 0421 920 622



More information about the cgiapp mailing list