Forest/Tree/Roles/LoadWithMetaData.pm

filter: Statementstmt 95.4% 21 / 22 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod n/a totaltotal 90.3% 28 / 31 CC 3 SCAR 6.9
CC
3
Cov
92%
__ANON__
3.0
__ANON__
2.0
BEGIN
1.0
CRAP 2.0
« Forest/Tree/Pure.pm ↑ Summary Forest/Tree/Writer/SimpleHTML.pm »
1 package Forest::Tree::Roles::LoadWithMetaData;
2 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 our $VERSION = '0.10';
5 1 our $AUTHORITY = 'cpan:STEVAN';
6  
7 has 'metadata' => (
8 is => 'rw',
9 isa => 'HashRef',
10 0 ▶ default => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
11 1 );
12  
13 has 'metadata_key' => (
14 is => 'rw',
15 isa => 'Str',
16 1 ▶ default => sub { 'uid' },
Subroutine __ANON__: called CC=1 SCAR=0.0
17 1 );
18  
19 10 ▶around 'create_new_subtree' => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
20 10 my $next = shift;
21 10 my $self = shift;
22 10 my $tree = $self->$next(@_);
23  
24 10 ▶ ($tree->does('Forest::Tree::Roles::MetaData'))
Branch: 1 branch
BranchTrueFalseTotal
$tree->does("Forest::Tree::Roles::MetaData") or confess("Your subtrees must do the MetaData role") 10 0 10
25 || confess "Your subtrees must do the MetaData role";
26  
27 10 my $key = $self->metadata_key;
28 10 ▶ if (my $metadata = $self->metadata->{ $tree->$key() }) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $metadata = $self->metadata->{$tree->$key}) 4 6 10
29 4 $tree->metadata($metadata);
30 }
31  
32 10 return $tree;
33 1 };
34  
35 1 ▶no Moose::Role; 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 __END__
« Forest/Tree/Pure.pm ↑ Summary Forest/Tree/Writer/SimpleHTML.pm »