| 1 | 20 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 20 | ▶ | use warnings FATAL => 'all'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | package HTML::Tested::List; | ||||||||||||||||||||
| 5 | 20 | ▶ | use HTML::Tested::List::Renderer; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 20 | ▶ | use HTML::Tested::List::Table; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 20 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 22 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||
| 10 | 22 | my ($class, $parent, $name, $c, %args) = @_; | |||||||||||||||||||
| 11 | 22 | ▶ | $args{name} ||= $name; | ||||||||||||||||||
|
Condition33%1/3
$args{"name"} ||= $name
MC/DC0%0/2
$args{"name"} ||= $name
$args{"name"}
$name
Truth table33%1/3
A ||= B
A= $args{"name"}B= $name
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 22 | my @renderers = ('HTML::Tested::List::Renderer'); | |||||||||||||||||||
| 14 | 22 | ▶ | push @renderers, HTML::Tested::List::Table->new if $args{render_table}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 22 | ▶ | $args{renderers} ||= \@renderers; | ||||||||||||||||||
|
Condition100%2/2
$args{"renderers"} ||= \@renderers
MC/DC100%1/1
$args{"renderers"} ||= \@renderers
$args{"renderers"}
Truth table100%2/2
A
A= $args{"renderers"}
| |||||||||||||||||||||
| 17 | { | ||||||||||||||||||||
| 18 | 20 | ▶ | no strict 'refs'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | 22 | ▶ | if (!$c) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 20 | 5 | $c = "$parent\::Item$name"; | |||||||||||||||||||
| 21 | 5 | ▶ | push @{ "$c\::ISA" }, ($args{cbase} || "HTML::Tested"); | ||||||||||||||||||
|
Condition100%2/2
$args{'cbase'} || 'HTML::Tested'
MC/DC100%1/1
$args{'cbase'} || 'HTML::Tested'
$args{'cbase'}
Truth table100%2/2
A
A= $args{'cbase'}
| |||||||||||||||||||||
| 22 | } | ||||||||||||||||||||
| 23 | 22 | ▶ | *{ "$parent\::$name\_containee" } = sub { return $c; }; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | 22 | ▶ | *{ "$parent\::$name\_containee_do" } = sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 25 | 1 | my ($self, $func, @args) = @_; | |||||||||||||||||||
| 26 | 1 | return $self->$name($c->$func(@args)); | |||||||||||||||||||
| 27 | 22 | }; | |||||||||||||||||||
| 28 | }; | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 22 | ▶ | $args{containee} ||= $c; | ||||||||||||||||||
|
Condition33%1/3
$args{"containee"} ||= $c
MC/DC0%0/2
$args{"containee"} ||= $c
$args{"containee"}
$c
Truth table33%1/3
A ||= B
A= $args{"containee"}B= $c
| |||||||||||||||||||||
| 31 | 22 | my $self = bless(\%args, $class); | |||||||||||||||||||
| 32 | 22 | for my $r (@{ $self->renderers }) { | |||||||||||||||||||
| 33 | 26 | $r->init($self, $parent); | |||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | 21 | return $self; | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 405 | ▶ | sub name { return shift()->{name}; } | ||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 39 | 58 | ▶ | sub renderers { return shift()->{renderers}; } | ||||||||||||||||||
|
Subroutine
renderers: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 40 | 0 | ▶ | sub options { return {}; } | ||||||||||||||||||
|
Subroutine
options: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 41 | 2 | ▶ | sub _get_option { return undef; } | ||||||||||||||||||
|
Subroutine
_get_option: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 36 | ▶ | sub render { | ||||||||||||||||||
|
Subroutine
render: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 44 | 36 | my ($self, $caller, $stash, $id) = @_; | |||||||||||||||||||
| 45 | 36 | for my $r (@{ $self->renderers }) { | |||||||||||||||||||
| 46 | 40 | $r->render($self, $caller, $stash, $id); | |||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | } | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 147 | ▶ | sub containee { | ||||||||||||||||||
|
Subroutine
containee: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||
| 51 | 147 | ▶ | my $res = shift()->{containee} or confess "No containee argument given"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 52 | 147 | return $res; | |||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 3 | ▶ | sub bless_from_tree { | ||||||||||||||||||
|
Subroutine
bless_from_tree: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 56 | 3 | my ($self, $p) = @_; | |||||||||||||||||||
| 57 | 3 | my $target = $self->containee; | |||||||||||||||||||
| 58 | 3 | return [ map { $target->ht_bless_from_tree($_) } @$p ]; | |||||||||||||||||||
| 59 | } | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 1 | ▶ | sub merge_one_value { shift()->_do_one_value("merge_one_value", @_); } | ||||||||||||||||||
|
Subroutine
merge_one_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 62 | 119 | ▶ | sub absorb_one_value { shift()->_do_one_value("absorb_one_value", @_); } | ||||||||||||||||||
|
Subroutine
absorb_one_value: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | 120 | ▶ | sub _do_one_value { | ||||||||||||||||||
|
Subroutine
_do_one_value: called CC=4 SCAR=13.9
| |||||||||||||||||||||
| 65 | 120 | my ($self, $func, $root, $val, @path) = @_; | |||||||||||||||||||
| 66 | 120 | ▶ | my $arr = $root->{ $self->name } || []; | ||||||||||||||||||
|
Condition100%2/2
$$root{$self->name} || []
MC/DC100%1/1
$$root{$self->name} || []
$$root{$self->name}
Truth table100%2/2
A
A= $$root{$self->name}
| |||||||||||||||||||||
| 67 | 120 | ▶ | my $id = shift(@path) or return; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 68 | 120 | ▶ | $arr->[--$id] ||= bless({}, $self->containee); | ||||||||||||||||||
|
Condition100%2/2
$$arr[--$id] ||= bless({}, $self->containee)
MC/DC100%1/1
$$arr[--$id] ||= bless({}, $self->containee)
$$arr[--$id]
Truth table100%2/2
A
A= $$arr[--$id]
| |||||||||||||||||||||
| 69 | 120 | $arr->[$id]->_ht_set_one($func, $val, @path); | |||||||||||||||||||
| 70 | 120 | $root->{ $self->name } = $arr; | |||||||||||||||||||
| 71 | } | ||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 13 | ▶ | sub finish_load { | ||||||||||||||||||
|
Subroutine
finish_load: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 74 | 13 | my ($self, $root) = @_; | |||||||||||||||||||
| 75 | 13 | my @arr = grep { $_ } @{ $root->{ $self->name } }; | |||||||||||||||||||
| 76 | 13 | ▶ | $root->{ $self->name } = \@arr unless $self->{keep_holes}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 77 | 13 | $_->_call_finish_load for @arr; | |||||||||||||||||||
| 78 | } | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | 5 | ▶ | sub validate { | ||||||||||||||||||
|
Subroutine
validate: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||
| 81 | 5 | my ($self, $caller) = @_; | |||||||||||||||||||
| 82 | 5 | my $n = $self->name; | |||||||||||||||||||
| 83 | 5 | ▶ | my $arr = $caller->$n || []; | ||||||||||||||||||
|
Condition100%2/2
$caller->$n || []
MC/DC100%1/1
$caller->$n || []
$caller->$n
Truth table100%2/2
A
A= $caller->$n
| |||||||||||||||||||||
| 84 | 5 | my @res; | |||||||||||||||||||
| 85 | 5 | ▶ | for (my $i = 0; $i < @$arr; $i++) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 86 | 6 | push @res, map { [ | |||||||||||||||||||
| 87 | 2 | sprintf('%s__%d__%s', $n, $i + 1, shift @$_), @$_ | |||||||||||||||||||
| 88 | ] } $arr->[$i]->ht_validate; | ||||||||||||||||||||
| 89 | } | ||||||||||||||||||||
| 90 | 5 | return @res; | |||||||||||||||||||
| 91 | } | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | 20 | 1; | |||||||||||||||||||
| 94 | |||||||||||||||||||||