Zing/Zang/Launcher.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod n/a totaltotal 0.0% 0 / 44 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Zing::Zang::Launcher;
2  
3 use 5.014;
4  
5 use strict;
6 use warnings;
7  
8 use registry;
9 use routines;
10  
11 use Data::Object::Class;
12 use Data::Object::ClassHas;
13  
14 extends 'Zing::Launcher';
15  
16 our $VERSION = '0.11'; # VERSION
17  
18 # ATTRIBUTES
19  
20 has 'on_perform' => (
21 is => 'ro',
22 isa => 'Maybe[CodeRef]',
23 opt => 1,
24 );
25  
26 has 'on_receive' => (
27 is => 'ro',
28 isa => 'Maybe[CodeRef]',
29 opt => 1,
30 );
31  
32 has 'queues' => (
33 is => 'ro',
34 isa => 'ArrayRef[Str]',
35 req => 1,
36 );
37  
38 # METHODS
39  
40 method receive(@args) {
41 return $self if !$self->on_receive;
42  
43 $self->on_receive->($self, @args);
44  
45 return $self;
46 }
47  
48 method perform(@args) {
49 return $self if !$self->on_perform;
50  
51 $self->on_perform->($self, @args);
52  
53 return $self;
54 }
55  
56 1;
57 =encoding utf8
58  
59 =head1 NAME
60  
61 Zing::Zang::Launcher - Process Launcher
62  
63 =cut
64  
65 =head1 ABSTRACT
66  
67 Process Launcher Implementation
68  
69 =cut
70  
71 =head1 SYNOPSIS
72  
73 use Zing::Zang::Launcher;
74  
75 my $zang = Zing::Zang::Launcher->new(
76 queues => ['launch'],
77 );
78  
79 # $zang->execute;
80  
81 =cut
82  
83 =head1 DESCRIPTION
84  
85 This package provides a L<Zing::Launcher> which uses callbacks and doesn't need
86 to be subclassd. It supports providing a list of queues to listen to which will
87 load, instantiate and execute schemes recevied.
88  
89 =cut
90  
91 =head1 INHERITS
92  
93 This package inherits behaviors from:
94  
95 L<Zing::Launcher>
96  
97 =cut
98  
99 =head1 LIBRARIES
100  
101 This package uses type constraints from:
102  
103 L<Zing::Types>
104  
105 =cut
106  
107 =head1 ATTRIBUTES
108  
109 This package has the following attributes:
110  
111 =cut
112  
113 =head2 on_perform
114  
115 on_perform(Maybe[CodeRef])
116  
117 This attribute is read-only, accepts C<(Maybe[CodeRef])> values, and is optional.
118  
119 =cut
120  
121 =head2 on_receive
122  
123 on_receive(Maybe[CodeRef])
124  
125 This attribute is read-only, accepts C<(Maybe[CodeRef])> values, and is optional.
126  
127 =cut
128  
129 =head2 queues
130  
131 queues(ArrayRef[Str])
132  
133 This attribute is read-only, accepts C<(ArrayRef[Str])> values, and is required.
134  
135 =cut
136  
137 =head1 AUTHOR
138  
139 Al Newkirk, C<awncorp@cpan.org>
140  
141 =head1 LICENSE
142  
143 Copyright (C) 2011-2019, Al Newkirk, et al.
144  
145 This is free software; you can redistribute it and/or modify it under the terms
146 of the The Apache License, Version 2.0, as elucidated in the L<"license
147 file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>.
148  
149 =head1 PROJECT
150  
151 L<Wiki|https://github.com/iamalnewkirk/zing/wiki>
152  
153 L<Project|https://github.com/iamalnewkirk/zing>
154  
155 L<Initiatives|https://github.com/iamalnewkirk/zing/projects>
156  
157 L<Milestones|https://github.com/iamalnewkirk/zing/milestones>
158  
159 L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md>
160  
161 L<Issues|https://github.com/iamalnewkirk/zing/issues>
162  
163 =cut