line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Debugbar; |
2
|
1
|
|
|
1
|
|
65313
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
193985
|
|
|
1
|
|
|
|
|
6
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
1542
|
use Mojo::Debugbar; |
|
1
|
|
|
|
|
49446
|
|
|
1
|
|
|
|
|
12
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.0.2'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head2 register |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=cut |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub register { |
13
|
0
|
|
|
0
|
1
|
|
my ($self, $app, $config) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $debugbar = Mojo::Debugbar->new(app => $app, config => $config); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$app->hook(around_dispatch => sub { |
18
|
0
|
|
|
0
|
|
|
my ($next, $c) = @_; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Start recording |
21
|
0
|
|
|
|
|
|
$debugbar->start; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$next->(); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Stop recording |
26
|
0
|
|
|
|
|
|
$debugbar->stop; |
27
|
0
|
|
|
|
|
|
}); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$app->hook(after_render => sub { |
30
|
0
|
|
|
0
|
|
|
my ($c, $output, $format) = @_; |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
0
|
|
|
|
if (!$c->stash('mojo.static') && !$c->res->is_redirect && $$output =~ m/<\/body>/) { |
|
|
|
0
|
|
|
|
|
33
|
|
|
|
|
|
|
# Render the debugbar html |
34
|
0
|
|
|
|
|
|
my $html = $debugbar->render; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Inject the debugbar html |
37
|
0
|
|
|
|
|
|
$$output =~ s/<\/body>/$html\n<\/body>/ig; |
38
|
|
|
|
|
|
|
} |
39
|
0
|
|
|
|
|
|
}); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |