File Coverage

blib/lib/Tree/Object/Hash.pm
Criterion Covered Total %
statement 22 22 100.0
branch 4 4 100.0
condition 2 4 50.0
subroutine 7 7 100.0
pod 3 3 100.0
total 38 40 95.0


line stmt bran cond sub pod time code
1             package Tree::Object::Hash;
2              
3 1     1   81931 use 5.010001;
  1         16  
4 1     1   7 use strict;
  1         2  
  1         20  
5 1     1   5 use warnings;
  1         2  
  1         26  
6              
7 1     1   429 use Role::Tiny::With;
  1         5265  
  1         227  
8              
9             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10             our $DATE = '2021-10-07'; # DATE
11             our $DIST = 'Tree-Object'; # DIST
12             our $VERSION = '0.080'; # VERSION
13              
14             with 'Role::TinyCommons::Tree::NodeMethods';
15              
16             sub new {
17 13     13 1 4465 my $class = shift;
18 13         22 my %attrs = @_;
19 13   50     56 $attrs{_parent} //= undef;
20 13   50     46 $attrs{_children} //= [];
21 13         80 bless \%attrs, $class;
22             }
23              
24             sub parent {
25 143     143 1 49522 my $self = shift;
26 143 100       349 $self->{_parent} = $_[0] if @_;
27 143         320 $self->{_parent};
28             }
29              
30             sub children {
31 170     170 1 11444 my $self = shift;
32              
33 170 100       351 $self->{_children} = $_[0] if @_;
34 170         407 $self->{_children};
35             }
36              
37             1;
38             # ABSTRACT: A hash-based tree object
39              
40             __END__