| 1 | package DSL::HTML::Parser; | ||||||||||||||||||||||||||||||||||
| 2 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||
| 5 | 7 | ▶ | use Devel::Declare::Interface; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use base 'Exporter::Declare::Magic::Parser'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | 7 | ▶ | BEGIN { Devel::Declare::Interface::register_parser('dsl_html') } | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||
| 9 | 7 | our %NAMELESS; | |||||||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub nameless { $NAMELESS{$_[-1]}++ } | ||||||||||||||||||||||||||||||||
|
Subroutine
nameless: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 11 | 124 | ▶ | sub is_nameless { $NAMELESS{shift->name} } | ||||||||||||||||||||||||||||||||
|
Subroutine
is_nameless: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub args { (qw/name/) } | ||||||||||||||||||||||||||||||||
|
Subroutine
args: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||
| 15 | 62 | ▶ | sub inject { | ||||||||||||||||||||||||||||||||
|
Subroutine
inject: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 16 | 62 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 17 | 62 | ▶ | return if $self->is_nameless; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 18 | 62 | ▶ | return if $self->has_fat_comma; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 19 | 62 | return ('my $tag = shift;'); | |||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||
| 22 | 62 | ▶ | sub rewrite { | ||||||||||||||||||||||||||||||||
|
Subroutine
rewrite: called CC=10 SCAR=32.4
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 23 | 62 | my $self = shift; | |||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||
| 25 | 62 | ▶ | return 1 if $self->is_nameless; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||
| 27 | 62 | $self->strip_prototype; | |||||||||||||||||||||||||||||||||
| 28 | 62 | $self->_check_parts; | |||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||
| 30 | 62 | ▶ | my $is_arrow = $self->parts->[1] | ||||||||||||||||||||||||||||||||
|
Condition50%3/6
$self->parts->[1] && ($self->parts->[1] eq '=>' || $self->parts->[1] eq ',')
$self->parts->[1] eq "=>" or $self->parts->[1] eq ","
MC/DC0%0/3
$self->parts->[1] && ($self->parts->[1] eq '=>' || $self->parts->[1] eq ',')
$self->parts->[1]
$self->parts->[1] eq "=>"
$self->parts->[1] eq ","
Truth table50%2/4
A && B or C
A= $self->parts->[1]B= $self->parts->[1] eq "=>"C= $self->parts->[1] eq ","
| |||||||||||||||||||||||||||||||||||
| 31 | && ( $self->parts->[1] eq '=>' || $self->parts->[1] eq ',' ); | ||||||||||||||||||||||||||||||||||
| 32 | 62 | ▶ | if ( $is_arrow && $self->parts->[2] ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$is_arrow and $self->parts->[2]
MC/DC0%0/2
$is_arrow and $self->parts->[2]
$is_arrow
$self->parts->[2]
Truth table33%1/3
A and B
A= $is_arrowB= $self->parts->[2]
| |||||||||||||||||||||||||||||||||||
| 33 | 0 | my $is_ref = ref( $self->parts->[2] ); | |||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | my $is_sub = $is_ref ? $self->parts->[2]->[0] eq 'sub' : 0; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if ( !$is_ref ) { | ||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||
| 37 | 0 | $self->new_parts( [$self->parts->[0], $self->parts->[2]] ); | |||||||||||||||||||||||||||||||||
| 38 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||
| 40 | elsif ($is_sub) { | ||||||||||||||||||||||||||||||||||
| 41 | 0 | $self->new_parts( [$self->parts->[0]] ); | |||||||||||||||||||||||||||||||||
| 42 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||
| 44 | else { | ||||||||||||||||||||||||||||||||||
| 45 | 0 | $self->bail('oops'); | |||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||
| 49 | 62 | my ( $names, $specs ) = $self->sort_parts(); | |||||||||||||||||||||||||||||||||
| 50 | $self->new_parts( | ||||||||||||||||||||||||||||||||||
| 51 | [ | ||||||||||||||||||||||||||||||||||
| 52 | @$names, | ||||||||||||||||||||||||||||||||||
| 53 | @$specs | ||||||||||||||||||||||||||||||||||
| 54 | ? ( | ||||||||||||||||||||||||||||||||||
| 55 | 62 | ▶ | ( map { $_->[0] } @$specs ), | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 56 | ['block'] | ||||||||||||||||||||||||||||||||||
| 57 | ) | ||||||||||||||||||||||||||||||||||
| 58 | : () | ||||||||||||||||||||||||||||||||||
| 59 | ] | ||||||||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||
| 62 | 62 | 1; | |||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||
| 65 | 7 | 1; | |||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||
| 67 | __END__ | ||||||||||||||||||||||||||||||||||