Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added error doc mapping Moved more logic into Session middleware Added Credit example to app.psgi Made StackTrace and Debug panel automatically turn on when debug mode enabled Fixed errorHandler
- Loading branch information
Showing
7 changed files
with
114 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package WebGUI::Middleware::Debug; | ||
use strict; | ||
use parent qw(Plack::Middleware); | ||
use Plack::Middleware::StackTrace; | ||
use Plack::Middleware::Debug; | ||
use Plack::Middleware::HttpExceptions; | ||
|
||
=head1 NAME | ||
WebGUI::Middleware::Debug - | ||
=head1 DESCRIPTION | ||
This is PSGI middleware for WebGUI that | ||
=cut | ||
|
||
sub call { | ||
my ( $self, $env ) = @_; | ||
|
||
my $session = $env->{'webgui.session'} or die 'WebGUI::Session missing'; | ||
|
||
my $app = $self->app; | ||
|
||
if ( $session->log->canShowDebug ) { | ||
warn 'seeing webgui.debug'; | ||
$env->{'webgui.debug'} = 1; | ||
$app = Plack::Middleware::StackTrace->wrap($app); | ||
$app = Plack::Middleware::Debug->wrap( $app, | ||
panels => [qw(Environment Response Timer Memory Session DBITrace PerlConfig Response)] ); | ||
} | ||
|
||
# Turn exceptions into HTTP errors | ||
$app = Plack::Middleware::HTTPExceptions->wrap( $app ); | ||
|
||
return $app->($env); | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.