| 1 | package Zing::Logic; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 49 | ▶ | use 5.014; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 49 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 49 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 49 | ▶ | use registry 'Zing::Types'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 49 | ▶ | use routines; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 49 | ▶ | use Data::Object::Class; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 49 | ▶ | use Data::Object::ClassHas; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 49 | ▶ | use Zing::Flow; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 49 | our $VERSION = '0.11'; # VERSION | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | # ATTRIBUTES | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 49 | has 'interupt' => ( | |||||||||||||||||||||||||||
| 21 | is => 'rw', | ||||||||||||||||||||||||||||
| 22 | isa => 'Interupt', | ||||||||||||||||||||||||||||
| 23 | opt => 1 | ||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 49 | has 'on_perform' => ( | |||||||||||||||||||||||||||
| 27 | is => 'ro', | ||||||||||||||||||||||||||||
| 28 | isa => 'CodeRef', | ||||||||||||||||||||||||||||
| 29 | new => 1, | ||||||||||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | fun new_on_perform($self) { | ||||||||||||||||||||||||||
|
Subroutine
new_on_perform: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 33 | 0 | $self->can('handle_perform_event') | |||||||||||||||||||||||||||
| 34 | 49 | } | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 49 | has 'on_receive' => ( | |||||||||||||||||||||||||||
| 37 | is => 'ro', | ||||||||||||||||||||||||||||
| 38 | isa => 'CodeRef', | ||||||||||||||||||||||||||||
| 39 | new => 1, | ||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | fun new_on_receive($self) { | ||||||||||||||||||||||||||
|
Subroutine
new_on_receive: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 0 | $self->can('handle_receive_event') | |||||||||||||||||||||||||||
| 44 | 49 | } | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 49 | has 'on_register' => ( | |||||||||||||||||||||||||||
| 47 | is => 'ro', | ||||||||||||||||||||||||||||
| 48 | isa => 'CodeRef', | ||||||||||||||||||||||||||||
| 49 | new => 1, | ||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | fun new_on_register($self) { | ||||||||||||||||||||||||||
|
Subroutine
new_on_register: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | 0 | $self->can('handle_register_event') | |||||||||||||||||||||||||||
| 54 | 49 | } | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 49 | has 'on_reset' => ( | |||||||||||||||||||||||||||
| 57 | is => 'ro', | ||||||||||||||||||||||||||||
| 58 | isa => 'CodeRef', | ||||||||||||||||||||||||||||
| 59 | new => 1, | ||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 0 | ▶ | fun new_on_reset($self) { | ||||||||||||||||||||||||||
|
Subroutine
new_on_reset: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 63 | 0 | $self->can('handle_reset_event') | |||||||||||||||||||||||||||
| 64 | 49 | } | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 49 | has 'on_suicide' => ( | |||||||||||||||||||||||||||
| 67 | is => 'ro', | ||||||||||||||||||||||||||||
| 68 | isa => 'CodeRef', | ||||||||||||||||||||||||||||
| 69 | new => 1, | ||||||||||||||||||||||||||||
| 70 | ); | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | fun new_on_suicide($self) { | ||||||||||||||||||||||||||
|
Subroutine
new_on_suicide: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 73 | 0 | $self->can('handle_suicide_event') | |||||||||||||||||||||||||||
| 74 | 49 | } | |||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 49 | has 'process' => ( | |||||||||||||||||||||||||||
| 77 | is => 'ro', | ||||||||||||||||||||||||||||
| 78 | isa => 'Process', | ||||||||||||||||||||||||||||
| 79 | req => 1, | ||||||||||||||||||||||||||||
| 80 | ); | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | # SHIMS | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | sub _kill { | ||||||||||||||||||||||||||||
| 85 | 0 | ▶ | CORE::kill(shift, shift) | ||||||||||||||||||||||||||
|
Subroutine
_kill: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | sub _repr { | ||||||||||||||||||||||||||||
| 89 | 0 | ▶ | "$_[0]" =~ s/^((?:[\w:]+=*)\w+)\((\w+)\)/($1)/r | ||||||||||||||||||||||||||
|
Subroutine
_repr: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | sub _words { | ||||||||||||||||||||||||||||
| 93 | 0 | ▶ | (map {ref() ? _repr($_) : m/\s+/ ? qq("$_") : $_} @_) | ||||||||||||||||||||||||||
|
Subroutine
_words: not called CC=3 SCAR=24.8
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | # METHODS | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 0 | ▶ | method debug(Any @data) { | ||||||||||||||||||||||||||
|
Subroutine
debug: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 99 | 0 | ▶ | if ($ENV{ZING_DEBUG}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | 0 | $self->process->log->debug( | |||||||||||||||||||||||||||
| 101 | join ' ', sprintf('in %s, %s', _words($self, $self->process)), @data | ||||||||||||||||||||||||||||
| 102 | ); | ||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | 0 | return $self; | |||||||||||||||||||||||||||
| 105 | 49 | } | |||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 0 | ▶ | method flow() { | ||||||||||||||||||||||||||
|
Subroutine
flow: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 108 | 0 | ▶ | my $step_0 = Zing::Flow->new( | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 109 | name => 'on_register', | ||||||||||||||||||||||||||||
| 110 | 0 | code => fun($step, $loop) { $self->trace('on_register')->($self) } | |||||||||||||||||||||||||||
| 111 | ); | ||||||||||||||||||||||||||||
| 112 | 0 | ▶ | my $step_1 = $step_0->next(Zing::Flow->new( | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 113 | name => 'on_perform', | ||||||||||||||||||||||||||||
| 114 | 0 | code => fun($step, $loop) { $self->trace('on_perform')->($self) } | |||||||||||||||||||||||||||
| 115 | )); | ||||||||||||||||||||||||||||
| 116 | 0 | ▶ | my $step_2 = $step_1->next(Zing::Flow->new( | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 117 | name => 'on_receive', | ||||||||||||||||||||||||||||
| 118 | 0 | code => fun($step, $loop) { $self->trace('on_receive')->($self) } | |||||||||||||||||||||||||||
| 119 | )); | ||||||||||||||||||||||||||||
| 120 | 0 | ▶ | my $step_3 = $step_2->next(Zing::Flow->new( | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 121 | name => 'on_reset', | ||||||||||||||||||||||||||||
| 122 | 0 | code => fun($step, $loop) { $self->trace('on_reset')->($self) } | |||||||||||||||||||||||||||
| 123 | )); | ||||||||||||||||||||||||||||
| 124 | 0 | ▶ | my $step_4 = $step_3->next(Zing::Flow->new( | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 125 | name => 'on_suicide', | ||||||||||||||||||||||||||||
| 126 | 0 | code => fun($step, $loop) { $self->trace('on_suicide')->($self) } | |||||||||||||||||||||||||||
| 127 | )); | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 0 | $step_0 | |||||||||||||||||||||||||||
| 130 | 49 | } | |||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 0 | ▶ | method handle_perform_event() { | ||||||||||||||||||||||||||
|
Subroutine
handle_perform_event: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 133 | 0 | my $process = $self->process; | |||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 0 | ▶ | return $self if !$process->can('perform'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 0 | $process->perform(); | |||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | return $self; | |||||||||||||||||||||||||||
| 140 | 49 | } | |||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | ▶ | method handle_receive_event() { | ||||||||||||||||||||||||||
|
Subroutine
handle_receive_event: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 143 | 0 | my $process = $self->process; | |||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 0 | ▶ | return $self if !$process->can('mailbox'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 0 | ▶ | return $self if !$process->can('receive'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my $data = $process->mailbox->recv or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 0 | $process->receive($data->{from}, $data->{data}); | |||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 0 | return $self; | |||||||||||||||||||||||||||
| 153 | 49 | } | |||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 0 | ▶ | method handle_register_event() { | ||||||||||||||||||||||||||
|
Subroutine
handle_register_event: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 156 | 0 | my $process = $self->process; | |||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 0 | ▶ | return $self if $self->{registered}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 0 | $self->{registered} = $process->registry->send($process); | |||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 0 | return $self; | |||||||||||||||||||||||||||
| 163 | 49 | } | |||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | 0 | ▶ | method handle_reset_event() { | ||||||||||||||||||||||||||
|
Subroutine
handle_reset_event: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 166 | 0 | my $process = $self->process; | |||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if ($process->journal && $process->log->count) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$process->journal and $process->log->count
MC/DC0%0/2
$process->journal and $process->log->count
$process->journal
$process->log->count
Truth table0%0/3
A and B
A= $process->journalB= $process->log->count
| |||||||||||||||||||||||||||||
| 169 | 0 | $process->journal->send({ | |||||||||||||||||||||||||||
| 170 | from => $process->name, | ||||||||||||||||||||||||||||
| 171 | data => { | ||||||||||||||||||||||||||||
| 172 | logs => $process->log->serialize, | ||||||||||||||||||||||||||||
| 173 | tag => $process->tag | ||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | }); | ||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 0 | $process->log->reset; | |||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | 0 | return $self; | |||||||||||||||||||||||||||
| 181 | 49 | } | |||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | ▶ | method handle_suicide_event() { | ||||||||||||||||||||||||||
|
Subroutine
handle_suicide_event: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 184 | 0 | my $process = $self->process; | |||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 0 | ▶ | return $self if !$process->parent; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | # children who don't known their parents kill themeselves :) | ||||||||||||||||||||||||||||
| 189 | 0 | ▶ | $process->winddown unless $process->ping($process->parent->node->pid); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 0 | return $self; | |||||||||||||||||||||||||||
| 192 | 49 | } | |||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 0 | ▶ | method signals() { | ||||||||||||||||||||||||||
|
Subroutine
signals: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 195 | 0 | my $trapped = {}; | |||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | $trapped->{INT} = sub { | ||||||||||||||||||||||||||||
| 198 | 0 | ▶ | $self->trace('interupt', 'INT'); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 199 | 0 | $self->process->winddown; | |||||||||||||||||||||||||||
| 200 | 0 | }; | |||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | $trapped->{QUIT} = sub { | ||||||||||||||||||||||||||||
| 203 | 0 | ▶ | $self->trace('interupt', 'QUIT'); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 204 | 0 | $self->process->winddown; | |||||||||||||||||||||||||||
| 205 | 0 | }; | |||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | $trapped->{TERM} = sub { | ||||||||||||||||||||||||||||
| 208 | 0 | ▶ | $self->trace('interupt', 'TERM'); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 209 | 0 | $self->process->winddown; | |||||||||||||||||||||||||||
| 210 | 0 | }; | |||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | 0 | return $trapped; | |||||||||||||||||||||||||||
| 213 | 49 | } | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | ▶ | method trace(Str $method, Any @args) { | ||||||||||||||||||||||||||
|
Subroutine
trace: not called CC=4 SCAR=30.0
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | 0 | ▶ | my @with = (@args ? (join ', ', 'with', _words(@args)) : ()); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 0 | return $self->debug(qq(invokes "$method"), @with)->$method(@args); | |||||||||||||||||||||||||||
| 219 | 49 | } | |||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 49 | 1; | |||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | =encoding utf8 | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | =head1 NAME | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | Zing::Logic - Process Logic | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | =cut | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | =head1 ABSTRACT | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | Process Logic Chain | ||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||
| 235 | =cut | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | use Zing::Logic; | ||||||||||||||||||||||||||||
| 240 | use Zing::Process; | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | my $process = Zing::Process->new; | ||||||||||||||||||||||||||||
| 243 | my $logic = Zing::Logic->new(process => $process); | ||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | =cut | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | This package provides the logic (or logic chain) to be executed by the process | ||||||||||||||||||||||||||||
| 250 | event-loop. | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | =cut | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | =head1 LIBRARIES | ||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | This package uses type constraints from: | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | L<Zing::Types> | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | =cut | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | =head1 ATTRIBUTES | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | This package has the following attributes: | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =cut | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | =head2 interupt | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | interupt(Interupt) | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | This attribute is read-only, accepts C<(Interupt)> values, and is optional. | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | =cut | ||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | =head2 on_perform | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | on_perform(CodeRef) | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | This attribute is read-only, accepts C<(CodeRef)> values, and is optional. | ||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||
| 282 | =cut | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | =head2 on_receive | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | on_receive(CodeRef) | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | This attribute is read-only, accepts C<(CodeRef)> values, and is optional. | ||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||
| 290 | =cut | ||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | =head2 on_register | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | on_register(CodeRef) | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | This attribute is read-only, accepts C<(CodeRef)> values, and is optional. | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | =cut | ||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||
| 300 | =head2 on_reset | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | on_reset(CodeRef) | ||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | This attribute is read-only, accepts C<(CodeRef)> values, and is optional. | ||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||
| 306 | =cut | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | =head2 on_suicide | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | on_suicide(CodeRef) | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | This attribute is read-only, accepts C<(CodeRef)> values, and is optional. | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | =cut | ||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||
| 316 | =head2 process | ||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||
| 318 | process(Process) | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | This attribute is read-only, accepts C<(Process)> values, and is required. | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | =cut | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | =head1 METHODS | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | This package implements the following methods: | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | =cut | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | =head2 flow | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | flow() : Flow | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | The flow method builds and returns the logic flow for the process event-loop. | ||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||
| 336 | =over 4 | ||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||
| 338 | =item flow example #1 | ||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | # given: synopsis | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | my $flow = $logic->flow; | ||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | =back | ||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||
| 346 | =cut | ||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||
| 348 | =head2 signals | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | signals() : HashRef | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | The signals method builds and returns the process signal handlers. | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | =over 4 | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | =item signals example #1 | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | # given: synopsis | ||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | my $signals = $logic->signals; | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | =back | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | =cut | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | Al Newkirk, C<awncorp@cpan.org> | ||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | Copyright (C) 2011-2019, Al Newkirk, et al. | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | This is free software; you can redistribute it and/or modify it under the terms | ||||||||||||||||||||||||||||
| 375 | of the The Apache License, Version 2.0, as elucidated in the L<"license | ||||||||||||||||||||||||||||
| 376 | file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>. | ||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||
| 378 | =head1 PROJECT | ||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||
| 380 | L<Wiki|https://github.com/iamalnewkirk/zing/wiki> | ||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||
| 382 | L<Project|https://github.com/iamalnewkirk/zing> | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | L<Initiatives|https://github.com/iamalnewkirk/zing/projects> | ||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||
| 386 | L<Milestones|https://github.com/iamalnewkirk/zing/milestones> | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md> | ||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||
| 390 | L<Issues|https://github.com/iamalnewkirk/zing/issues> | ||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | =cut | ||||||||||||||||||||||||||||