2012/7/31 MARKSTOS via RT <bug-CGI-Application-Dispatch@rt.cpan.org>:
Show quoted text> <URL:
https://rt.cpan.org/Ticket/Display.html?id=78552 >
>
> On Tue Jul 24 10:31:01 2012, silent2600@gmail.com wrote:
>> env: mod_perl2,
>> I shutdown database, then run web application,
>>
>> the webpage display:
>> "Can't locate object method "error" via package "Error executing run
>> mode 'default': DBI
>> connect('database=db;host=127.0.0.1;port=3306','root',...) failed:
>> Can't connect to MySQL server on '127.0.0.1' (10061) at MyDB.pm line
>> 60
>> at CGI/Application/Dispatch.pm line 707 (perhaps you forgot to load
>> "Error executing run mode 'default': DBI
>> connect('database=db;host=127.0.0.1;port=3306','root',..."
>>
>> the string "Error executing run mode ..." is from
>> CGI::Application::__get_body(),
>> Dispatch.pm catch it at line around 410, then call "the long
>> string"->error in http_error(), so the application died.
>
> What version of CGI::Application::Dispatch exhibits this issue? Could
provide you a
Show quoted text> test case or a patch?
capd version: 3.07
test it again in FastCGI:
#1. /cap/AAA/Test.pm
package AAA::Test;
use base qw/CGI::Application/;
sub setup {
my $self = shift;
$self->run_modes(['good', 'bad']);
$self->start_mode('good');
}
sub good {
return "good runmode capd version:
$CGI::Application::Dispatch::VERSION";
}
sub bad {
die "THIS IS ONLY A ERROR MESSAGE";
}
1;
#2. /cap/AAA/Dispatch.pm
package AAA::Dispatch;
use base 'CGI::Application::Dispatch';
use AAA::Test;
sub dispatch_args {
return {
table => [
'test' => { prefix => 'AAA', app => 'Test', rm => 'good' },
'/test/:rm' => { prefix => 'AAA', app => 'Test' }
],
error_document => '"Oops... HTTP Error #%s',
debug => 0
};
}
1;
#3. app.fcgi
#!/usr/bin/perl
use lib "/cap/";
use AAA::Dispatch;
use CGI::Fast qw(:standard);
while ( new CGI::Fast ) {
AAA::Dispatch->dispatch();
}
# spawn-fcgi -f /cap/app.fcgi -s /tmp/fcgi.sock -n -M 666
when request to
http://127.0.0.1/app/test/bad
got such error logs and fastcgi process exit:
2012/08/03 06:07:23 [error] 9024#0: *1 FastCGI sent in stderr:
Can't locate object method "error" via package "Error executing run mode
'bad': THIS IS ONLY A ERROR MESSAGE at /cap//AAA/Test.pm line 17.
at /usr/local/share/perl5/CGI/Application/Dispatch.pm line 707
" (perhaps you forgot to load "Error executing run mode 'bad': THIS IS ONLY
A ERROR MESSAGE at /cap//AAA/Test.pm line 17.
at /usr/local/share/perl5/CGI/Application/Dispatch.pm line 707
"?) at /usr/local/share/perl5/CGI/Application/Dispatch.pm line 438.
I changed Dispatch.pm line 440:
< . $e->error . "\n";
---
Show quoted text> . (ref $e ? $e->error : "\n");