Skip Menu |

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

Report information
The Basics
Id: 16689
Status: resolved
Priority: 0/
Queue: CGI-Application-Plugin-DebugScreen

People
Owner: Nobody in particular
Requestors: mpeter [...] plusthree.com
Cc:
AdminCc:

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



Subject: CAP::DebugScreen and ErrorDocument
I decided to play with CAP::DebugScreen (since it uses my CAP::ViewCode and I was interested to see what someone is doing with my stuff :) and I have to say that I like it. It's fairly simple and really easy for tracking down fatal errors with a nice stack trace. Overall it's pretty spiffy :) However, I did have some problems getting it to work correctly with my setup. I typically use an ErrorDocument setting in httpd.conf so that all errors are the same throughout a site. However, CAP::DebugScreen only works if fatal errors are thrown and it doesn't add a error_mode() but instead uses the 'error' callback. So while the callback is executed, no error_mode() exists, so C::A simply croaks() and Apache will serve a different doc, not the one generated by CAP::DebugScreen. Attached is a patch that will make CAP::DS add an error_mode during the init phase instead of the error callback.
--- /usr/local/lib/perl5/site_perl/5.8.7/CGI/Application/Plugin/DebugScreen.pm 2005-12-21 19:51:00.000000000 -0500 +++ /usr/local/lib/perl5/site_perl/5.8.7/CGI/Application/Plugin/DebugScreen.pm.NEW 2005-12-22 14:03:57.000000000 -0500 @@ -133,6 +133,7 @@ $caller->add_callback( 'init', sub{ my $self = shift; + $self->error_mode('__debugscreen_error'); my $de; $SIG{__DIE__} = sub{ push @{$self->{__stacktrace}},[Devel::StackTrace->new(ignore_package=>[qw/CGI::Application::Plugin::DebugScreen Carp CGI::Carp/])->frames]; @@ -141,20 +142,20 @@ { no strict 'refs'; *{"$caller\::report"} = \&debug_report; - } - }); - $caller->add_callback( 'error', sub{ - my $self = shift; - if ( - exists $INC{'CGI/Application/Plugin/ViewCode.pm'} - && - ! exists $INC{'CGI/Application/Dispatch.pm'} - ) - { - $self->{__viewcode}++; + *{"$caller\::__debugscreen_error"} = sub{ + my $self = shift; + if ( + exists $INC{'CGI/Application/Plugin/ViewCode.pm'} + && + ! exists $INC{'CGI/Application/Dispatch.pm'} + ) + { + $self->{__viewcode}++; + } + $self->report(@_); + }; } - $self->report(@_); }); if ( ! exists $INC{'CGI/Application/Dispatch.pm'} && @@ -217,8 +218,7 @@ ); $self->header_props( -type => 'text/html' ); - my $headers = $self->_send_headers(); - print $headers.$t->output; + return $t->output; } sub print_context {
[WONKO - Thu Dec 22 15:33:58 2005]: Show quoted text
> I decided to play with CAP::DebugScreen (since it uses my > CAP::ViewCode and I > was interested to see what someone is doing with my stuff :) and I > have to say > that I like it. It's fairly simple and really easy for tracking down > fatal > errors with a nice stack trace. Overall it's pretty spiffy :) > > However, I did have some problems getting it to work correctly with my > setup. I > typically use an ErrorDocument setting in httpd.conf so that all > errors are the > same throughout a site. However, CAP::DebugScreen only works if fatal > errors are > thrown and it doesn't add a error_mode() but instead uses the 'error' > callback. > So while the callback is executed, no error_mode() exists, so C::A > simply > croaks() and Apache will serve a different doc, not the one generated > by > CAP::DebugScreen. > > Attached is a patch that will make CAP::DS add an error_mode during > the init > phase instead of the error callback.
OK. I check it. Please wait... atsushi
[guest - Sat Dec 24 22:32:40 2005]: Show quoted text
> [WONKO - Thu Dec 22 15:33:58 2005]: >
> > I decided to play with CAP::DebugScreen (since it uses my > > CAP::ViewCode and I > > was interested to see what someone is doing with my stuff :) and I > > have to say > > that I like it. It's fairly simple and really easy for tracking down > > fatal > > errors with a nice stack trace. Overall it's pretty spiffy :) > > > > However, I did have some problems getting it to work correctly with
> my
> > setup. I > > typically use an ErrorDocument setting in httpd.conf so that all > > errors are the > > same throughout a site. However, CAP::DebugScreen only works if
> fatal
> > errors are > > thrown and it doesn't add a error_mode() but instead uses the
> 'error'
> > callback. > > So while the callback is executed, no error_mode() exists, so C::A > > simply > > croaks() and Apache will serve a different doc, not the one
> generated
> > by > > CAP::DebugScreen. > > > > Attached is a patch that will make CAP::DS add an error_mode during > > the init > > phase instead of the error callback.
> > > OK. > I check it. > Please wait... > > atsushi
Hi. I updated new version. Please check it. atsushi
closed