| 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
| |||||||||||||||||||||
| 36 | 5 | ▶ | if (@_) { # Setter | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 37 | 0 | ▶ | croak "Cannot set `outputs` of @{[$self->name]} to non-hashref " . | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$_[0] // "(undef)"
MC/DC0%0/1
$_[0] // "(undef)"
$_[0]
Truth table0%0/2
A
A= $_[0]
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||