Forest/Tree/Roles/MetaData.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran 70.0% 7 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 50.0% 1 / 2 totaltotal 87.8% 36 / 41 CC 6 SCAR 14.2
CC
6
Cov
88%
fetch_metadata_for
6.2
BEGIN
1.0
__ANON__
1.0
CRAP 4.1
« Forest/Tree/Loader/SimpleUIDLoader.pm ↑ Summary Forest/Tree/Writer/ASCIIWithBranches.pm »
1 package Forest::Tree::Roles::MetaData;
2 3 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 3 our $VERSION = '0.10';
5 3 our $AUTHORITY = 'cpan:STEVAN';
6  
7 has 'metadata' => (
8 is => 'rw',
9 isa => 'HashRef',
10 11 ▶ default => sub { {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
11 3 );
12  
13 1 ▶sub get_metadata_for {
Subroutine get_metadata_for: called CC=1 SCAR=0.0
Pod undocumented
14 1 my ($self, $key) = @_;
15  
16 1 return $self->metadata->{$key};
17 }
18  
19 12 ▶sub fetch_metadata_for {
Subroutine fetch_metadata_for: called CC=6 SCAR=18.3
Pod documented
20 12 my ($self, $key) = @_;
21  
22 12 my $current = $self;
23  
24 12 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$current->is_root or do { do { if ($current->does(__PACKAGE__)) { my $meta = $current->metadata; return $meta->{$key} if exists $meta->{$key}; } ; $current = $current->parent } } 1 2 3
25 14 ▶ if ($current->does(__PACKAGE__)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current->does(__PACKAGE__)) 14 0 14
26 14 my $meta = $current->metadata;
27 return $meta->{$key}
28 14 ▶ if exists $meta->{$key};
Branch: 1 branch
BranchTrueFalseTotal
if exists $meta->{$key} 11 3 14
29 }
30 3 $current = $current->parent;
31 } until $current->is_root;
32  
33 1 ▶ if ($current->does(__PACKAGE__)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($current->does(__PACKAGE__)) 1 0 1
34 1 my $meta = $current->metadata;
35 return $meta->{$key}
36 1 ▶ if exists $meta->{$key};
Branch: 1 branch
BranchTrueFalseTotal
if exists $meta->{$key} 1 0 1
37 }
38  
39 0 return;
40 }
41  
42 3 ▶no Moose::Role; 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 __END__
« Forest/Tree/Loader/SimpleUIDLoader.pm ↑ Summary Forest/Tree/Writer/ASCIIWithBranches.pm »