Zing/Logic/Single.pm

filter: Statementstmt 46.8% 22 / 47 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 6 / 12 Podpod 50.0% 1 / 2 totaltotal 47.5% 29 / 61 CC 1 SCAR 4.1
CC
1
Cov
47%
flow
2.0
__ANON__
2.0
__ANON__
2.0
CRAP 1.5
« Zing/Node.pm ↑ Summary Zing/Single.pm »
1 package Zing::Logic::Single;
2  
3 8 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 8 ▶use registry 'Zing::Types';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 8 ▶use routines;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 8 ▶use Data::Object::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 8 extends 'Zing::Logic';
14  
15 8 our $VERSION = '0.11'; # VERSION
16  
17 # METHODS
18  
19 0 ▶method flow() {
Subroutine flow: not called CC=1 SCAR=6.9
Pod documented
20 0 ▶ my $step_0 = Zing::Flow->new(
Subroutine __ANON__: not called CC=1 SCAR=6.9
21 name => 'on_register',
22 0 code => fun($step, $loop) { $self->trace('on_register')->($self) }
23 );
24 0 ▶ my $step_1 = $step_0->next(Zing::Flow->new(
Subroutine __ANON__: not called CC=1 SCAR=6.9
25 name => 'on_perform',
26 0 code => fun($step, $loop) { $self->trace('on_perform')->($self) }
27 ));
28 0 ▶ my $step_2 = $step_1->next(Zing::Flow->new(
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 name => 'on_reset',
30 0 code => fun($step, $loop) { $self->trace('on_reset')->($self) }
31 ));
32 0 ▶ my $step_3 = $step_2->next(Zing::Flow->new(
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 name => 'on_suicide',
34 0 code => fun($step, $loop) { $self->trace('on_suicide')->($self) }
35 ));
36  
37 0 $step_0
38 8 }
39  
40 0 ▶method handle_perform_event() {
Subroutine handle_perform_event: not called CC=1 SCAR=6.9
Pod undocumented
41 0 my $process = $self->process;
42  
43 0 my $result = $self->next::method;
44  
45 0 $process->winddown;
46  
47 0 return $result;
48 8 }
49  
50 8 1;
51  
52 =encoding utf8
53  
54 =head1 NAME
55  
56 Zing::Logic::Single - Single Logic
57  
58 =cut
59  
60 =head1 ABSTRACT
61  
62 Single Process Logic Chain
63  
64 =cut
65  
66 =head1 SYNOPSIS
67  
68 package Single;
69  
70 use parent 'Zing::Single';
71  
72 package main;
73  
74 use Zing::Logic::Single;
75  
76 my $logic = Zing::Logic::Single->new(process => Single->new);
77  
78 # $logic->execute;
79  
80 =cut
81  
82 =head1 DESCRIPTION
83  
84 This package provides the logic (or logic chain) to be executed by the process
85 event-loop.
86  
87 =cut
88  
89 =head1 INHERITS
90  
91 This package inherits behaviors from:
92  
93 L<Zing::Logic>
94  
95 =cut
96  
97 =head1 LIBRARIES
98  
99 This package uses type constraints from:
100  
101 L<Zing::Types>
102  
103 =cut
104  
105 =head1 ATTRIBUTES
106  
107 This package has the following attributes:
108  
109 =cut
110  
111 =head2 interupt
112  
113 interupt(Interupt)
114  
115 This attribute is read-only, accepts C<(Interupt)> values, and is optional.
116  
117 =cut
118  
119 =head2 on_perform
120  
121 on_perform(CodeRef)
122  
123 This attribute is read-only, accepts C<(CodeRef)> values, and is optional.
124  
125 =cut
126  
127 =head2 on_receive
128  
129 on_receive(CodeRef)
130  
131 This attribute is read-only, accepts C<(CodeRef)> values, and is optional.
132  
133 =cut
134  
135 =head2 on_register
136  
137 on_register(CodeRef)
138  
139 This attribute is read-only, accepts C<(CodeRef)> values, and is optional.
140  
141 =cut
142  
143 =head2 on_reset
144  
145 on_reset(CodeRef)
146  
147 This attribute is read-only, accepts C<(CodeRef)> values, and is optional.
148  
149 =cut
150  
151 =head2 on_suicide
152  
153 on_suicide(CodeRef)
154  
155 This attribute is read-only, accepts C<(CodeRef)> values, and is optional.
156  
157 =cut
158  
159 =head2 process
160  
161 process(Process)
162  
163 This attribute is read-only, accepts C<(Process)> values, and is required.
164  
165 =cut
166  
167 =head1 METHODS
168  
169 This package implements the following methods:
170  
171 =cut
172  
173 =head2 flow
174  
175 flow() : Flow
176  
177 The flow method builds and returns the logic flow for the process event-loop.
178  
179 =over 4
180  
181 =item flow example #1
182  
183 # given: synopsis
184  
185 my $flow = $logic->flow;
186  
187 =back
188  
189 =cut
190  
191 =head2 signals
192  
193 signals() : HashRef
194  
195 The signals method builds and returns the process signal handlers.
196  
197 =over 4
198  
199 =item signals example #1
200  
201 # given: synopsis
202  
203 my $signals = $logic->signals;
204  
205 =back
206  
207 =cut
208  
209 =head1 AUTHOR
210  
211 Al Newkirk, C<awncorp@cpan.org>
212  
213 =head1 LICENSE
214  
215 Copyright (C) 2011-2019, Al Newkirk, et al.
216  
217 This is free software; you can redistribute it and/or modify it under the terms
218 of the The Apache License, Version 2.0, as elucidated in the L<"license
219 file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>.
220  
221 =head1 PROJECT
222  
223 L<Wiki|https://github.com/iamalnewkirk/zing/wiki>
224  
225 L<Project|https://github.com/iamalnewkirk/zing>
226  
227 L<Initiatives|https://github.com/iamalnewkirk/zing/projects>
228  
229 L<Milestones|https://github.com/iamalnewkirk/zing/milestones>
230  
231 L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md>
232  
233 L<Issues|https://github.com/iamalnewkirk/zing/issues>
234  
235 =cut
« Zing/Node.pm ↑ Summary Zing/Single.pm »