Permalink
Browse files

A couple of sample debugging psgi files

One for Plack::Middleware::Debug and one for Plack::Debugger.
  • Loading branch information...
1 parent 25737a2 commit 42c2d8658123104119d72f727fafdafa4f5cdf20 @davorg committed Dec 6, 2015
Showing with 73 additions and 0 deletions.
  1. +54 −0 Literature/bin/debug2_app.psgi
  2. +19 −0 Literature/bin/debug_app.psgi
@@ -0,0 +1,54 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Plack::Builder;
+
+use JSON;
+
+use Plack::Debugger;
+use Plack::Debugger::Storage;
+
+use Plack::App::Debugger;
+
+use Plack::Debugger::Panel::Timer;
+use Plack::Debugger::Panel::AJAX;
+use Plack::Debugger::Panel::Memory;
+use Plack::Debugger::Panel::Warnings;
+use Plack::Debugger::Panel::ModuleVersions;
+use Plack::Debugger::Panel::Parameters;
+
+my $debugger = Plack::Debugger->new(
+ storage => Plack::Debugger::Storage->new(
+ data_dir => '/tmp/debugger_panel',
+ serializer => sub { encode_json( shift ) },
+ deserializer => sub { decode_json( shift ) },
+ filename_fmt => "%s.json",
+ ),
+ panels => [
+ Plack::Debugger::Panel::Timer->new,
+ Plack::Debugger::Panel::AJAX->new,
+ Plack::Debugger::Panel::Memory->new,
+ Plack::Debugger::Panel::Warnings->new,
+ Plack::Debugger::Panel::ModuleVersions->new,
+ Plack::Debugger::Panel::Parameters->new,
+ ]
+);
+
+my $debugger_app = Plack::App::Debugger->new( debugger => $debugger );
+
+use Literature;
+my $app = Literature->to_app;
+
+builder {
+ mount $debugger_app->base_url => $debugger_app->to_app;
+
+ mount '/' => builder {
+ enable $debugger_app->make_injector_middleware;
+ enable $debugger->make_collector_middleware;
+ $app;
+ }
+};
@@ -0,0 +1,19 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Plack::Builder;
+
+use Literature;
+my $app = Literature->to_app;
+
+builder {
+ enable 'Debug', panels =>
+ [ qw(Environment Response Timer Memory),
+ [ 'DBITrace', level => 2 ]
+ ];
+ $app;
+}

0 comments on commit 42c2d86

Please sign in to comment.