Zing/Zang/Timer.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 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::Zang::Timer;
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  
14 extends 'Zing::Timer';
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 'schedules' => (
33 is => 'ro',
34 isa => 'ArrayRef[Schedule]',
35 req => 1,
36 );
37  
38 1;
39 =encoding utf8
40  
41 =head1 NAME
42  
43 Zing::Zang::Timer - Timer Process
44  
45 =cut
46  
47 =head1 ABSTRACT
48  
49 Timer Process Implementation
50  
51 =cut
52  
53 =head1 SYNOPSIS
54  
55 use Zing::Zang::Timer;
56  
57 my $zang = Zing::Zang::Timer->new(
58 schedules => [['@minute', ['tasks'], {do => 1}]],
59 );
60  
61 # $zang->execute;
62  
63 =cut
64  
65 =head1 DESCRIPTION
66  
67 This package provides a L<Zing::Timer> which uses callbacks and doesn't need to
68 be subclassd. It supports providing a process C<perform> method as
69 C<on_perform> and a C<receive> method as C<on_receive> which operate as
70 expected, and also a C<schedules> attribute which takes a list of schedules to
71 enforce.
72  
73 =cut
74  
75 =head1 INHERITS
76  
77 This package inherits behaviors from:
78  
79 L<Zing::Timer>
80  
81 =cut
82  
83 =head1 LIBRARIES
84  
85 This package uses type constraints from:
86  
87 L<Zing::Types>
88  
89 =cut
90  
91 =head1 ATTRIBUTES
92  
93 This package has the following attributes:
94  
95 =cut
96  
97 =head2 on_perform
98  
99 on_perform(Maybe[CodeRef])
100  
101 This attribute is read-only, accepts C<(Maybe[CodeRef])> values, and is optional.
102  
103 =cut
104  
105 =head2 on_receive
106  
107 on_receive(Maybe[CodeRef])
108  
109 This attribute is read-only, accepts C<(Maybe[CodeRef])> values, and is optional.
110  
111 =cut
112  
113 =head2 schedules
114  
115 schedules(ArrayRef[Schedule])
116  
117 This attribute is read-only, accepts C<(ArrayRef[Schedule])> values, and is required.
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