| 1 | package Mojo::Debugbar::Monitor; | ||
| 2 | 1 | ▶ | use Mojo::Base -base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 1 | ▶ | use Mojo::JSON qw(encode_json); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Mojo::Server; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 0 | ▶ | has 'app' => sub { Mojo::Server->new->build_app('Mojo::HelloWorld') }, weak => 1; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 8 | 1 | has 'icon' => ''; | |
| 9 | 0 | ▶ | has 'items' => sub { [] }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||
| 10 | 1 | has 'name' => 'Monitor'; | |
| 11 | |||
| 12 | =head2 count | ||
| 13 | |||
| 14 | Returns the number that will be shown in the title | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | 0 | ▶ | sub count { |
|
Subroutine
count: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 19 | 0 | return scalar(@{ shift->items }); | |
| 20 | } | ||
| 21 | |||
| 22 | =head2 inject | ||
| 23 | |||
| 24 | Inject as javascript | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | 0 | ▶ | sub inject { |
|
Subroutine
inject: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 29 | 0 | my $self = shift; | |
| 30 | |||
| 31 | 0 | my $rows = $self->rows; | |
| 32 | |||
| 33 | # replace "`" with "'" $rows | ||
| 34 | 0 | $rows =~ s/`/'/g; | |
| 35 | |||
| 36 | 0 | return sprintf('$(\'table[data-debugbar-ref="%s"] tbody\').prepend(`%s`);', ref($self), $rows); | |
| 37 | } | ||
| 38 | |||
| 39 | =head2 render | ||
| 40 | |||
| 41 | Returns the html | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | 0 | ▶ | sub render { |
|
Subroutine
render: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 46 | 0 | return ''; | |
| 47 | } | ||
| 48 | |||
| 49 | =head2 rows | ||
| 50 | |||
| 51 | Build the rows | ||
| 52 | |||
| 53 | =cut | ||
| 54 | |||
| 55 | 0 | ▶ | sub rows { |
|
Subroutine
rows: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 56 | 0 | return ''; | |
| 57 | } | ||
| 58 | |||
| 59 | =head2 stop | ||
| 60 | |||
| 61 | Stop the monitor | ||
| 62 | |||
| 63 | =cut | ||
| 64 | |||
| 65 | 0 | ▶ | sub stop { |
|
Subroutine
stop: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 66 | 0 | shift->items([]); | |
| 67 | } | ||
| 68 | |||
| 69 | =head2 start | ||
| 70 | |||
| 71 | Start the monitor | ||
| 72 | |||
| 73 | =cut | ||
| 74 | |||
| 75 | 0 | ▶ | sub start { |
|
Subroutine
start: not called CC=1 SCAR=0.0
Pod
documented
| |||
| 76 | } | ||
| 77 | |||
| 78 | 1 | 1; | |