| 1 | package EPUB::Parser::Util::AttributePacker; | ||||||||||||
| 2 | 8 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 8 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 8 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 6 | ▶ | sub ordered_list { | ||||||||||
|
Subroutine
ordered_list: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||
| 7 | 6 | my $class = shift; | |||||||||||
| 8 | 6 | ▶ | my $nodes = shift || []; | ||||||||||
|
Condition50%1/2
shift() || []
MC/DC0%0/1
shift() || []
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 9 | 6 | my $item_list; | |||||||||||
| 10 | |||||||||||||
| 11 | 6 | for my $node ( @$nodes ) { | |||||||||||
| 12 | 54 | my $attr_container; | |||||||||||
| 13 | 54 | for my $attr ($node->attributes) { | |||||||||||
| 14 | 60 | $attr_container->{$attr->name} = $attr->value; | |||||||||||
| 15 | } | ||||||||||||
| 16 | 54 | push @$item_list, $attr_container; | |||||||||||
| 17 | } | ||||||||||||
| 18 | |||||||||||||
| 19 | 6 | return $item_list; | |||||||||||
| 20 | } | ||||||||||||
| 21 | |||||||||||||
| 22 | |||||||||||||
| 23 | 8 | ▶ | sub grouped_list { | ||||||||||
|
Subroutine
grouped_list: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||
| 24 | 8 | my $class = shift; | |||||||||||
| 25 | 8 | ▶ | my $nodes = shift || []; | ||||||||||
|
Condition50%1/2
shift() || []
MC/DC0%0/1
shift() || []
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 26 | 8 | ▶ | my $want_group = (shift || {})->{group}; | ||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 27 | |||||||||||||
| 28 | 8 | my $group_list; | |||||||||||
| 29 | |||||||||||||
| 30 | 8 | for my $node ( @$nodes ) { | |||||||||||
| 31 | 104 | my $attr_container; | |||||||||||
| 32 | 104 | for my $attr ($node->attributes) { | |||||||||||
| 33 | 328 | $attr_container->{$attr->name} = $attr->value; | |||||||||||
| 34 | } | ||||||||||||
| 35 | 104 | my $attr_group = delete $attr_container->{$want_group}; | |||||||||||
| 36 | |||||||||||||
| 37 | 104 | push @{$group_list->{$attr_group}}, $attr_container; | |||||||||||
| 38 | } | ||||||||||||
| 39 | |||||||||||||
| 40 | 8 | return $group_list; | |||||||||||
| 41 | |||||||||||||
| 42 | } | ||||||||||||
| 43 | |||||||||||||
| 44 | 7 | ▶ | sub by_uniq_key { | ||||||||||
|
Subroutine
by_uniq_key: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||
| 45 | 7 | my $class = shift; | |||||||||||
| 46 | 7 | ▶ | my $nodes = shift || []; | ||||||||||
|
Condition50%1/2
shift() || []
MC/DC0%0/1
shift() || []
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 47 | 7 | ▶ | my $key = (shift || {})->{key}; | ||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 48 | |||||||||||||
| 49 | 7 | my $by_uniq_key; | |||||||||||
| 50 | |||||||||||||
| 51 | 7 | for my $node ( @$nodes ) { | |||||||||||
| 52 | 91 | my $attr_container; | |||||||||||
| 53 | 91 | for my $attr ($node->attributes) { | |||||||||||
| 54 | 287 | $attr_container->{$attr->name} = $attr->value; | |||||||||||
| 55 | } | ||||||||||||
| 56 | |||||||||||||
| 57 | 91 | my $attr_key = delete $attr_container->{$key}; | |||||||||||
| 58 | 91 | $by_uniq_key->{$attr_key} = $attr_container; | |||||||||||
| 59 | } | ||||||||||||
| 60 | |||||||||||||
| 61 | 7 | return $by_uniq_key; | |||||||||||
| 62 | |||||||||||||
| 63 | } | ||||||||||||
| 64 | |||||||||||||
| 65 | |||||||||||||
| 66 | 8 | 1; | |||||||||||
| 67 | |||||||||||||