line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Plack::Middleware::Debug::DBITrace; |
2
|
2
|
|
|
2
|
|
900
|
use 5.008; |
|
2
|
|
|
|
|
7
|
|
3
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
33
|
|
4
|
2
|
|
|
2
|
|
28
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
5
|
2
|
|
|
2
|
|
14
|
use Plack::Util::Accessor qw(level); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
17
|
|
6
|
2
|
|
|
2
|
|
94
|
use parent qw(Plack::Middleware::Debug::Base); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
8
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.17'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub prepare_app { |
10
|
3
|
|
|
3
|
1
|
360
|
my $self = shift; |
11
|
3
|
50
|
|
|
|
12
|
$self->level(1) unless defined $self->level; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub run { |
15
|
3
|
|
|
3
|
1
|
25
|
my($self, $env, $panel) = @_; |
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
|
|
56
|
$panel->nav_subtitle("Level " . $self->level); |
18
|
|
|
|
|
|
|
|
19
|
3
|
|
|
|
|
48
|
my($old_trace, $output); |
20
|
3
|
50
|
|
|
|
40
|
if (defined &DBI::trace) { |
21
|
0
|
|
|
|
|
0
|
$old_trace = DBI->trace; |
22
|
0
|
|
|
|
|
0
|
open my $fh, ">", \$output; |
23
|
0
|
|
|
|
|
0
|
DBI->trace($self->level . ",SQL", $fh); |
24
|
|
|
|
|
|
|
} else { |
25
|
3
|
|
|
|
|
32
|
return $panel->disable; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return sub { |
29
|
0
|
|
|
0
|
|
|
my $res = shift; |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
if (defined $old_trace) { |
32
|
0
|
|
|
|
|
|
DBI->trace($old_trace); |
33
|
0
|
|
|
|
|
|
$panel->content($self->render_lines($output)); |
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
__END__ |