line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojo::Debugbar; |
2
|
1
|
|
|
1
|
|
71199
|
use Mojo::Base -base; |
|
1
|
|
|
|
|
199715
|
|
|
1
|
|
|
|
|
11
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
853
|
use Mojo::Debugbar::Monitors; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
5
|
1
|
|
|
1
|
|
623
|
use Mojo::Loader qw(load_class); |
|
1
|
|
|
|
|
36721
|
|
|
1
|
|
|
|
|
68
|
|
6
|
1
|
|
|
1
|
|
577
|
use Mojo::Server; |
|
1
|
|
|
|
|
10440
|
|
|
1
|
|
|
|
|
20
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.0.1'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'app' => sub { Mojo::Server->new->build_app('Mojo::HelloWorld') }, weak => 1; |
11
|
|
|
|
|
|
|
has 'config' => sub { {} }; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'monitors' => sub { |
14
|
|
|
|
|
|
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my @monitors; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
foreach my $module (@{ $self->app->config->{ debugbar }->{ monitors } || [] }) { |
19
|
|
|
|
|
|
|
my $monitor = _monitor($module, 1); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
push(@monitors, $monitor->new(app => $self->app)); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
return Mojo::Debugbar::Monitors->new( |
25
|
|
|
|
|
|
|
registered => \@monitors, |
26
|
|
|
|
|
|
|
hide_empty => $self->app->config->{ debugbar }->{ hide_empty }, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 render |
31
|
|
|
|
|
|
|
Proxy for monitors->render |
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub render { |
35
|
0
|
|
|
0
|
1
|
|
return shift->monitors->render; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 stop |
39
|
|
|
|
|
|
|
Proxy for monitors->stop |
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub stop { |
43
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$self->monitors->stop; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
return $self; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 start |
51
|
|
|
|
|
|
|
Proxy for monitors->start |
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub start { |
55
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
$self->monitors->start; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return $self; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 _monitor |
64
|
|
|
|
|
|
|
Load monitor |
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _monitor { |
68
|
0
|
|
|
0
|
|
|
my ($module, $fatal) = @_; |
69
|
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
return $module->isa('Mojo::Debugbar::Monitor') ? $module : undef |
|
|
0
|
|
|
|
|
|
71
|
|
|
|
|
|
|
unless my $e = load_class $module; |
72
|
0
|
0
|
0
|
|
|
|
$fatal && ref $e ? die $e : return undef; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |