Devel-Agent
view release on metacpan or search on metacpan
lib/Plack/Middleware/Devel/Agent/Plack.pm view on Meta::CPAN
package Plack::Middleware::Devel::Agent::Plack;
=head1 NAME
Plack::Middleware::Devel::Agent::Plack - Plack Middleware Agent Debugger
=head1 SYNOPSIS
PERL5OPT='-d:Agent' plackup --port 8777 -e 'enable "Plack::Middleware::Devel::Agent::Plack";package MyFirstApp;sub {[200,[qw(Content-Type text/plain)],["hello world\n"]]}'
=head1 DESCRIPTION
This debugger is handly for tracing all calls made within a psgi app, while excluding the guts of PSGI/Plack. Why? Well most of the time we want to know what is happening in our application, not in the PSGI layer as Plack/PSGI is pretty good at wha...
=cut
use Modern::Perl;
require Plack::Middleware;
use parent qw( Plack::Middleware );
require Plack::Util;
require Devel::Agent;
use Data::Dumper;
use Devel::Agent::Util qw(flush_row);
=head1 Configuration and env variables
At its core this is a configuration class for the debugger provided by Deve::Agent. As a result it can be programatically configigured at runtime.
=cut
our @EXCLUDE_DEFAULTS=(
# grab the defaults from the debugger
@DB::EXCLUDE_DEFAULTS,
qw(
Plack::Util::Prototype
Pack::Util
Plack::Util::Accessor
Plack::Component
Try::Tiny
HTTP::Message::PSGI
)
);#,'Plack::Middleware','Plack::Util');
our $VERSION=$Devel::Agent::VERSION;
our %AGENT_OPTIONS=(
excludes=>{
map { ($_,1) } @EXCLUDE_DEFAULTS
},
filter_on_args=>\&default_filter,
on_frame_end=>\&flush_row,
);
our %SELF_EXCLUDES=(
qw(
Plack::Util::response_cb 1
Plack::Util::__ANON__ 1
Plack::Util::header_remove 1
Plack::Util::inline_object 1
),
map {
(__PACKAGE__.'::'.$_,1) }
qw(
_chunk_handler
_start
)
);
sub default_filter {
my ($self,$frame,$args,$caller)=@_;
if(exists $SELF_EXCLUDES{$frame->{class_method}}) {
return 0;
}
return 1;
}
( run in 1.064 second using v1.01-cache-2.11-cpan-4ef0a570458 )