| 1 | # Data::Hopen::G::Node - base class for hopen nodes | ||||||||||||||||||||
| 2 | package Data::Hopen::G::Node; | ||||||||||||||||||||
| 3 | 12 | ▶ | use Data::Hopen; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 12 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 12 | ▶ | use Data::Hopen::Base; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 12 | our $VERSION = '0.000018'; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | sub outputs; | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 12 | ▶ | use parent 'Data::Hopen::G::Runnable'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 12 | ▶ | use Class::Tiny qw(outputs); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | =head1 NAME | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | Data::Hopen::G::Node - The base class for all hopen nodes | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | =head1 VARIABLES | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | =head2 outputs | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | Hashref of the outputs from the last time this node was run. Default C<{}>. | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | =cut | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | =head1 FUNCTIONS | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | =head2 outputs | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | Custom accessor for outputs, which enforces the invariant that outputs must | ||||||||||||||||||||
| 31 | be hashrefs. | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | =cut | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | sub outputs { | ||||||||||||||||||||
| 36 | 190 | ▶ | my $self = shift; | ||||||||||||||||||
|
Subroutine
outputs: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 37 | 190 | ▶ | croak 'Need an instance' unless $self; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 38 | 189 | ▶ | if (@_) { # Setter | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 39 | 63 | ▶ | croak "Cannot set `outputs` of @{[$self->name]} to non-hashref " . | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$_[0] // "(undef)"
MC/DC100%1/1
$_[0] // "(undef)"
$_[0]
Truth table100%2/2
A
A= $_[0]
| |||||||||||||||||||||
| 40 | ($_[0] // '(undef)') | ||||||||||||||||||||
| 41 | unless ref $_[0] eq 'HASH'; | ||||||||||||||||||||
| 42 | 61 | return $self->{outputs} = shift; | |||||||||||||||||||
| 43 | } elsif ( exists $self->{outputs} ) { # Getter | ||||||||||||||||||||
| 44 | 125 | return $self->{outputs}; | |||||||||||||||||||
| 45 | } else { # Default | ||||||||||||||||||||
| 46 | 1 | return +{}; | |||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | } #outputs() | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | #DEBUG: sub BUILD { use Data::Dumper; say __PACKAGE__,Dumper(\@_); } | ||||||||||||||||||||
| 51 | 12 | 1; | |||||||||||||||||||
| 52 | __END__ | ||||||||||||||||||||