Object/Hash.pm

filter: Statementstmt 100% 28 / 28 Branchbran 100% 4 / 4 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 91.6% 44 / 48 CC 5 SCAR 6.6
CC
5
Cov
94%
new
3.1
parent
2.0
children
2.0
CRAP 1.9
« Object/InsideOut.pm ↑ Summary Object/Array.pm »
1 package Tree::Object::Hash;
2  
3 2 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use Role::Tiny::With;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10 2 our $DATE = '2021-10-07'; # DATE
11 2 our $DIST = 'Tree-Object'; # DIST
12 2 our $VERSION = '0.080'; # VERSION
13  
14 2 with 'Role::TinyCommons::Tree::NodeMethods';
15  
16 13 ▶sub new {
Subroutine new: called CC=3 SCAR=11.3
Pod documented
17 13 my $class = shift;
18 13 my %attrs = @_;
19 13 ▶ $attrs{_parent} //= undef;
Condition50%1/2
$attrs{"_parent"} //= undef
l!l
013
MC/DC0%0/1
$attrs{"_parent"} //= undef
$attrs{"_parent"}
Truth table50%1/2
A
A= $attrs{"_parent"}
Aresult
11
00
20 13 ▶ $attrs{_children} //= [];
Condition50%1/2
$attrs{"_children"} //= []
l!l
013
MC/DC0%0/1
$attrs{"_children"} //= []
$attrs{"_children"}
Truth table50%1/2
A
A= $attrs{"_children"}
Aresult
11
00
21 13 bless \%attrs, $class;
22 }
23  
24 143 ▶sub parent {
Subroutine parent: called CC=2 SCAR=6.9
Pod documented
25 143 my $self = shift;
26 143 ▶ $self->{_parent} = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 17 126 143
27 143 $self->{_parent};
28 }
29  
30 170 ▶sub children {
Subroutine children: called CC=2 SCAR=6.9
Pod documented
31 170 my $self = shift;
32  
33 170 ▶ $self->{_children} = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 7 163 170
34 170 $self->{_children};
35 }
36  
37 2 1;
38 # ABSTRACT: A hash-based tree object
39  
40 __END__
« Object/InsideOut.pm ↑ Summary Object/Array.pm »