Skip Menu |

This queue is for tickets about the CGI-Application-Dispatch CPAN distribution.

Report information
The Basics
Id: 78552
Status: resolved
Priority: 0/
Queue: CGI-Application-Dispatch

People
Owner: MARKSTOS [...] cpan.org
Requestors: silent2600 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: CAP::Dispatch try to use error message from CAP as module
Date: Tue, 24 Jul 2012 22:30:36 +0800
To: bug-CGI-Application-Dispatch [...] rt.cpan.org
From: hx <silent2600 [...] gmail.com>
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.
On Tue Jul 24 10:31:01 2012, silent2600@gmail.com wrote: Show quoted text
> 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 test case or a patch?
Subject: Re: [rt.cpan.org #78552] CAP::Dispatch try to use error message from CAP as module
Date: Fri, 3 Aug 2012 06:25:57 +0800
To: bug-CGI-Application-Dispatch [...] rt.cpan.org
From: hx <silent2600 [...] gmail.com>
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");
There's a patch for this we're trying out in a new release today. Thanks for the feedback.