Zing/Spawner.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod n/a totaltotal 0.0% 0 / 33 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Zing::Spawner;
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  
13 extends 'Zing::Worker';
14  
15 our $VERSION = '0.26'; # VERSION
16  
17 # METHODS
18  
19 method handle(Str $name, HashRef $data) {
20 return $self if !$data->{scheme};
21  
22 my $fork = $self->spawn($data->{scheme});
23  
24 do {0} while $fork->sanitize;
25  
26 return $self;
27 }
28  
29 1;
30  
31 =encoding utf8
32  
33 =head1 NAME
34  
35 Zing::Spawner - Scheme Spawner
36  
37 =cut
38  
39 =head1 ABSTRACT
40  
41 Scheme Spawning Worker Process
42  
43 =cut
44  
45 =head1 SYNOPSIS
46  
47 package Spawner;
48  
49 use parent 'Zing::Spawner';
50  
51 sub queues {
52 ['schemes']
53 }
54  
55 package main;
56  
57 my $spawner = Spawner->new;
58  
59 # $spawner->execute;
60  
61 =cut
62  
63 =head1 DESCRIPTION
64  
65 This package provides a worker process which loads, instantiates, and executes
66 schemes received as messages.
67  
68 =cut
69  
70 =head1 INHERITS
71  
72 This package inherits behaviors from:
73  
74 L<Zing::Worker>
75  
76 =cut
77  
78 =head1 LIBRARIES
79  
80 This package uses type constraints from:
81  
82 L<Zing::Types>
83  
84 =cut
85  
86 =head1 METHODS
87  
88 This package implements the following methods:
89  
90 =cut
91  
92 =head2 handle
93  
94 handle(Str $name, HashRef $data) : Object
95  
96 The handle method is executed whenever the process receive a new message, and
97 receives the queue name and data as arguments.
98  
99 =over 4
100  
101 =item handle example #1
102  
103 # given: synopsis
104  
105 $spawner->handle('schemes', { scheme => ['MyApp', [], 1] });
106  
107 =back
108  
109 =over 4
110  
111 =item handle example #2
112  
113 # given: synopsis
114  
115 $spawner->handle('schemes', { scheme => ['MyApp', [], 4] });
116  
117 =back
118  
119 =cut
120  
121 =head1 AUTHOR
122  
123 Al Newkirk, C<awncorp@cpan.org>
124  
125 =head1 LICENSE
126  
127 Copyright (C) 2011-2019, Al Newkirk, et al.
128  
129 This is free software; you can redistribute it and/or modify it under the terms
130 of the The Apache License, Version 2.0, as elucidated in the L<"license
131 file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>.
132  
133 =head1 PROJECT
134  
135 L<Wiki|https://github.com/iamalnewkirk/zing/wiki>
136  
137 L<Project|https://github.com/iamalnewkirk/zing>
138  
139 L<Initiatives|https://github.com/iamalnewkirk/zing/projects>
140  
141 L<Milestones|https://github.com/iamalnewkirk/zing/milestones>
142  
143 L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md>
144  
145 L<Issues|https://github.com/iamalnewkirk/zing/issues>
146  
147 =cut