Hopen/G/Node.pm

filter: Statementstmt 90.4% 19 / 21 Branchbran 62.5% 5 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 78.9% 30 / 38 CC 6 SCAR 17.1
CC
6
Cov
77%
outputs
8.5
BEGIN
1.0
BEGIN
1.0
CRAP 5.5
« Hopen/Scope/Hash.pm ↑ Summary Hopen/Scope.pm »
1 # Build::Hopen::G::Node - base class for hopen nodes
2 package Build::Hopen::G::Node;
3 6 ▶use Build::Hopen;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use Build::Hopen::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 6 our $VERSION = '0.000008'; # TRIAL
7  
8 sub outputs;
9  
10 6 ▶use parent 'Build::Hopen::G::Runnable';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 6 ▶use Class::Tiny qw(outputs);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 =head1 NAME
14  
15 Build::Hopen::G::Node - The base class for all hopen nodes
16  
17 =head1 VARIABLES
18  
19 =head2 outputs
20  
21 Hashref of the outputs from the last time this node was run. Default C<{}>.
22  
23 =cut
24  
25 =head1 FUNCTIONS
26  
27 =head2 outputs
28  
29 Custom accessor for outputs, which enforces the invariant that outputs must
30 be hashrefs.
31  
32 =cut
33  
34 5 ▶sub outputs {
Subroutine outputs: called CC=6 SCAR=21.4
Pod documented
35 5 ▶ my $self = shift or croak 'Need an instance';
Branch: 1 branch
BranchTrueFalseTotal
my $self = shift() or croak("Need an instance") 5 0 5
36 5 ▶ if (@_) { # Setter
Branch: 2 branches
BranchTrueFalseTotal
if (@_) { } 2 3 5
elsif (exists $self->{'outputs'}) { } 3 0 3
37 0 ▶ croak "Cannot set `outputs` of @{[$self->name]} to non-hashref " .
Branch: 1 branch
BranchTrueFalseTotal
unless ref $_[0] eq "HASH" 0 2 2
Condition0%0/2
$_[0] // "(undef)"
l!l
00
MC/DC0%0/1
$_[0] // "(undef)"
$_[0]
Truth table0%0/2
A
A= $_[0]
Aresult
11
00
38 ($_[0] // '(undef)')
39 unless ref $_[0] eq 'HASH';
40 2 return $self->{outputs} = shift;
41 } elsif ( exists $self->{outputs} ) { # Getter
42 3 return $self->{outputs};
43 } else { # Default
44 0 return +{};
45 }
46 } #outputs()
47  
48 #DEBUG: sub BUILD { use Data::Dumper; say __PACKAGE__,Dumper(\@_); }
49 6 1;
50 __END__
« Hopen/Scope/Hash.pm ↑ Summary Hopen/Scope.pm »