| 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
MC/DC0%0/1
$attrs{"_parent"} //= undef
$attrs{"_parent"}
Truth table50%1/2
A
A= $attrs{"_parent"}
| |||||||||||||
| 20 | 13 | ▶ | $attrs{_children} //= []; | ||||||||||
|
Condition50%1/2
$attrs{"_children"} //= []
MC/DC0%0/1
$attrs{"_children"} //= []
$attrs{"_children"}
Truth table50%1/2
A
A= $attrs{"_children"}
| |||||||||||||
| 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
| |||||||||||||
| 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
| |||||||||||||
| 34 | 170 | $self->{_children}; | |||||||||||
| 35 | } | ||||||||||||
| 36 | |||||||||||||
| 37 | 2 | 1; | |||||||||||
| 38 | # ABSTRACT: A hash-based tree object | ||||||||||||
| 39 | |||||||||||||
| 40 | __END__ | ||||||||||||