Object/Hash/ChildrenAsList.pm

filter: Statementstmt 58.6% 17 / 29 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 3 totaltotal 42.8% 21 / 49 CC 5 SCAR 17.6
CC
5
Cov
46%
new
12.0
parent
6.0
children
6.0
CRAP 5.8
↑ Summary Object/InsideOut.pm »
1 package Tree::Object::Hash::ChildrenAsList;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Role::Tiny::With;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10 1 our $DATE = '2021-10-07'; # DATE
11 1 our $DIST = 'Tree-Object'; # DIST
12 1 our $VERSION = '0.080'; # VERSION
13  
14 1 with 'Role::TinyCommons::Tree::NodeMethods';
15  
16 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
17 0 my $class = shift;
18 0 my %attrs = @_;
19 0 ▶ $attrs{_parent} //= undef;
Condition0%0/2
$attrs{"_parent"} //= undef
l!l
00
MC/DC0%0/1
$attrs{"_parent"} //= undef
$attrs{"_parent"}
Truth table0%0/2
A
A= $attrs{"_parent"}
Aresult
11
00
20 0 ▶ $attrs{_children} //= [];
Condition0%0/2
$attrs{"_children"} //= []
l!l
00
MC/DC0%0/1
$attrs{"_children"} //= []
$attrs{"_children"}
Truth table0%0/2
A
A= $attrs{"_children"}
Aresult
11
00
21 0 bless \%attrs, $class;
22 }
23  
24 0 ▶sub parent {
Subroutine parent: not called CC=2 SCAR=17.9
Pod undocumented
25 0 my $self = shift;
26 0 ▶ $self->{_parent} = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
27 0 $self->{_parent};
28 }
29  
30 0 ▶sub children {
Subroutine children: not called CC=2 SCAR=17.9
Pod undocumented
31 0 my $self = shift;
32  
33 0 ▶ $self->{_children} = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
34 0 @{ $self->{_children} };
35 }
36  
37 1 1;
38 # ABSTRACT: A hash-based tree object, children() returns list
39  
40 __END__
↑ Summary Object/InsideOut.pm »