blib/lib/Moxy/Plugin/LocationBar.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 18 | 28 | 64.2 |
branch | 0 | 4 | 0.0 |
condition | 0 | 2 | 0.0 |
subroutine | 6 | 8 | 75.0 |
pod | 0 | 2 | 0.0 |
total | 24 | 44 | 54.5 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Moxy::Plugin::LocationBar; | ||||||
2 | 11 | 11 | 23651 | use strict; | |||
11 | 25 | ||||||
11 | 356 | ||||||
3 | 11 | 11 | 56 | use warnings; | |||
11 | 20 | ||||||
11 | 293 | ||||||
4 | 11 | 11 | 50 | use base qw/Moxy::Plugin/; | |||
11 | 20 | ||||||
11 | 462 | ||||||
5 | 11 | 11 | 551 | use Carp; | |||
11 | 19 | ||||||
11 | 1128 | ||||||
6 | 11 | 11 | 61 | use HTML::Entities; | |||
11 | 38 | ||||||
11 | 2783 | ||||||
7 | |||||||
8 | sub render_location_bar : Hook { | ||||||
9 | 0 | 0 | 0 | my ($self, $context, $args) = @_; | |||
10 | 0 | 0 | croak "invalid args" if ref $args ne 'HASH'; | ||||
11 | 0 | 0 | 0 | return unless (($args->{response}->header('Content-Type')||'') =~ /html/); | |||
12 | |||||||
13 | 0 | my $content = $args->{response}->content; | |||||
14 | 0 | my $bar = render_control_panel($args->{response}->request->uri); | |||||
15 | 0 | $content =~ s!( |
|||||
0 | |||||||
16 | 0 | $args->{response}->content( $content ); | |||||
17 | 11 | 11 | 68 | } | |||
11 | 23 | ||||||
11 | 79 | ||||||
18 | |||||||
19 | sub render_control_panel { | ||||||
20 | 0 | 0 | 0 | my $current_url = shift; | |||
21 | |||||||
22 | 0 | return sprintf(<<"...", encode_entities($current_url)); | |||||
23 | |||||||
26 | |||||||
27 | |||||||
28 | |||||||
29 | |||||||
30 | ... | ||||||
31 | } | ||||||
32 | |||||||
33 | 1; |