| 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
MC/DC0%0/1
$attrs{"_parent"} //= undef
$attrs{"_parent"}
Truth table0%0/2
A
A= $attrs{"_parent"}
| |||||||||||||
| 20 | 0 | ▶ | $attrs{_children} //= []; | ||||||||||
|
Condition0%0/2
$attrs{"_children"} //= []
MC/DC0%0/1
$attrs{"_children"} //= []
$attrs{"_children"}
Truth table0%0/2
A
A= $attrs{"_children"}
| |||||||||||||
| 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
| |||||||||||||
| 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
| |||||||||||||
| 34 | 0 | @{ $self->{_children} }; | |||||||||||
| 35 | } | ||||||||||||
| 36 | |||||||||||||
| 37 | 1 | 1; | |||||||||||
| 38 | # ABSTRACT: A hash-based tree object, children() returns list | ||||||||||||
| 39 | |||||||||||||
| 40 | __END__ | ||||||||||||