Zing/Ringer.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod n/a totaltotal 0.0% 0 / 45 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Zing::Ringer;
2  
3 use 5.014;
4  
5 use strict;
6 use warnings;
7  
8 use registry 'Zing::Types';
9 use routines;
10  
11 use Data::Object::Class;
12 use Data::Object::ClassHas;
13 use Data::Object::Space;
14  
15 extends 'Zing::Ring';
16  
17 our $VERSION = '0.11'; # VERSION
18  
19 # ATTRIBUTES
20  
21 has 'processes' => (
22 is => 'ro',
23 isa => 'ArrayRef[Process]',
24 mod => 1,
25 new => 1,
26 opt => 1,
27 );
28  
29 fun new_processes($self) {
30 [map $self->reify($_), @{$self->schemes}]
31 }
32  
33 has 'schemes' => (
34 is => 'ro',
35 isa => 'ArrayRef[Scheme]',
36 req => 1,
37 );
38  
39 # METHODS
40  
41 method reify(Scheme $scheme) {
42 my $class = $scheme->[0];
43 my $space = Data::Object::Space->new($class);
44 my $build = $space->build(@{$scheme->[1]});
45  
46 return $build;
47 }
48  
49 1;
50 =encoding utf8
51  
52 =head1 NAME
53  
54 Zing::Ringer - Scheme Ring
55  
56 =cut
57  
58 =head1 ABSTRACT
59  
60 Multi-Scheme Assembly Ring
61  
62 =cut
63  
64 =head1 SYNOPSIS
65  
66 use Zing::Ringer;
67  
68 my $ring = Zing::Ringer->new(schemes => [
69 ['MyApp', [], 1],
70 ['MyApp', [], 1],
71 ]);
72  
73 # $ring->execute;
74  
75 =cut
76  
77 =head1 DESCRIPTION
78  
79 This package provides a mechanism for joining two (or more) processes from
80 their scheme definitions and executes them as one in a turn-based manner.
81  
82 =cut
83  
84 =head1 INHERITS
85  
86 This package inherits behaviors from:
87  
88 L<Zing::Ring>
89  
90 =cut
91  
92 =head1 LIBRARIES
93  
94 This package uses type constraints from:
95  
96 L<Zing::Types>
97  
98 =cut
99  
100 =head1 ATTRIBUTES
101  
102 This package has the following attributes:
103  
104 =cut
105  
106 =head2 processes
107  
108 processes(ArrayRef[Process])
109  
110 This attribute is read-only, accepts C<(ArrayRef[Process])> values, and is optional.
111  
112 =cut
113  
114 =head2 schemes
115  
116 schemes(ArrayRef[Scheme])
117  
118 This attribute is read-only, accepts C<(ArrayRef[Scheme])> values, and is required.
119  
120 =cut
121  
122 =head1 METHODS
123  
124 This package implements the following methods:
125  
126 =cut
127  
128 =head2 reify
129  
130 reify(Scheme $scheme) : Process
131  
132 The reify method loads, instantiates, and returns a L<Zing::Process> derived
133 object from an application scheme.
134  
135 =over 4
136  
137 =item reify example #1
138  
139 # given: synopsis
140  
141 $ring->reify(['MyApp', [], 1]);
142  
143 =back
144  
145 =cut
146  
147 =head1 AUTHOR
148  
149 Al Newkirk, C<awncorp@cpan.org>
150  
151 =head1 LICENSE
152  
153 Copyright (C) 2011-2019, Al Newkirk, et al.
154  
155 This is free software; you can redistribute it and/or modify it under the terms
156 of the The Apache License, Version 2.0, as elucidated in the L<"license
157 file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>.
158  
159 =head1 PROJECT
160  
161 L<Wiki|https://github.com/iamalnewkirk/zing/wiki>
162  
163 L<Project|https://github.com/iamalnewkirk/zing>
164  
165 L<Initiatives|https://github.com/iamalnewkirk/zing/projects>
166  
167 L<Milestones|https://github.com/iamalnewkirk/zing/milestones>
168  
169 L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md>
170  
171 L<Issues|https://github.com/iamalnewkirk/zing/issues>
172  
173 =cut