Zing/Zang/Simple.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod n/a totaltotal 0.0% 0 / 37 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::Simple;
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::Simple';
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 method perform(@args) {
27 return $self if !$self->on_perform;
28  
29 $self->on_perform->($self, @args);
30  
31 return $self;
32 }
33  
34 1;
35 =encoding utf8
36  
37 =head1 NAME
38  
39 Zing::Zang::Simple - Simple-Task Process
40  
41 =cut
42  
43 =head1 ABSTRACT
44  
45 Simple-Task Process Implementation
46  
47 =cut
48  
49 =head1 SYNOPSIS
50  
51 use Zing::Zang::Simple;
52  
53 my $zang = Zing::Zang::Simple->new(
54 on_perform => sub {
55 my ($self) = @_;
56  
57 $self->{performed}++
58 }
59 );
60  
61 # $zang->execute;
62  
63 =cut
64  
65 =head1 DESCRIPTION
66  
67 This package provides a standard L<Zing::Process> which uses callbacks and
68 doesn't need to be subclassd. It supports providing the standard process
69 C<perform> method as C<on_perform>which operate as expected. This process does
70 not check its mailbox and does't support a C<receive> handler.
71  
72 =cut
73  
74 =head1 INHERITS
75  
76 This package inherits behaviors from:
77  
78 L<Zing::Simple>
79  
80 =cut
81  
82 =head1 LIBRARIES
83  
84 This package uses type constraints from:
85  
86 L<Zing::Types>
87  
88 =cut
89  
90 =head1 ATTRIBUTES
91  
92 This package has the following attributes:
93  
94 =cut
95  
96 =head2 on_perform
97  
98 on_perform(Maybe[CodeRef])
99  
100 This attribute is read-only, accepts C<(Maybe[CodeRef])> values, and is optional.
101  
102 =cut
103  
104 =head1 AUTHOR
105  
106 Al Newkirk, C<awncorp@cpan.org>
107  
108 =head1 LICENSE
109  
110 Copyright (C) 2011-2019, Al Newkirk, et al.
111  
112 This is free software; you can redistribute it and/or modify it under the terms
113 of the The Apache License, Version 2.0, as elucidated in the L<"license
114 file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>.
115  
116 =head1 PROJECT
117  
118 L<Wiki|https://github.com/iamalnewkirk/zing/wiki>
119  
120 L<Project|https://github.com/iamalnewkirk/zing>
121  
122 L<Initiatives|https://github.com/iamalnewkirk/zing/projects>
123  
124 L<Milestones|https://github.com/iamalnewkirk/zing/milestones>
125  
126 L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md>
127  
128 L<Issues|https://github.com/iamalnewkirk/zing/issues>
129  
130 =cut