| 1 | package Zing::Single; | ||
| 2 | |||
| 3 | 8 | ▶ | use 5.014; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 8 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 8 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 8 | ▶ | use registry 'Zing::Types'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 8 | ▶ | use routines; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 8 | ▶ | use Data::Object::Class; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 8 | ▶ | use Zing::Logic::Single; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 8 | extends 'Zing::Process'; | |
| 16 | |||
| 17 | 8 | our $VERSION = '0.11'; # VERSION | |
| 18 | |||
| 19 | # BUILDERS | ||
| 20 | |||
| 21 | 0 | ▶ | fun new_logic($self) { |
|
Subroutine
new_logic: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 22 | 0 | Zing::Logic::Single->new(process => $self) | |
| 23 | 8 | } | |
| 24 | |||
| 25 | 8 | 1; | |
| 26 | |||
| 27 | =encoding utf8 | ||
| 28 | |||
| 29 | =head1 NAME | ||
| 30 | |||
| 31 | Zing::Single - Single Process | ||
| 32 | |||
| 33 | =cut | ||
| 34 | |||
| 35 | =head1 ABSTRACT | ||
| 36 | |||
| 37 | Single Process | ||
| 38 | |||
| 39 | =cut | ||
| 40 | |||
| 41 | =head1 SYNOPSIS | ||
| 42 | |||
| 43 | package MyApp; | ||
| 44 | |||
| 45 | use parent 'Zing::Single'; | ||
| 46 | |||
| 47 | sub perform { | ||
| 48 | my ($self) = @_; | ||
| 49 | |||
| 50 | time; | ||
| 51 | } | ||
| 52 | |||
| 53 | sub receive { | ||
| 54 | my ($self, $from, $data) = @_; | ||
| 55 | |||
| 56 | [$from, $data]; | ||
| 57 | } | ||
| 58 | |||
| 59 | package main; | ||
| 60 | |||
| 61 | my $myapp = MyApp->new; | ||
| 62 | |||
| 63 | # $myapp->execute; | ||
| 64 | |||
| 65 | =cut | ||
| 66 | |||
| 67 | =head1 DESCRIPTION | ||
| 68 | |||
| 69 | This package provides a L<Zing::Process> which runs once and shuts-down, but | ||
| 70 | otherwise operates as a typical process and invokes its C<receive> and | ||
| 71 | C<perform> methods. | ||
| 72 | |||
| 73 | =cut | ||
| 74 | |||
| 75 | =head1 INHERITS | ||
| 76 | |||
| 77 | This package inherits behaviors from: | ||
| 78 | |||
| 79 | L<Zing::Process> | ||
| 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 SCENARIOS | ||
| 92 | |||
| 93 | This package supports the following scenarios: | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | =head2 perform | ||
| 98 | |||
| 99 | # given: synopsis | ||
| 100 | |||
| 101 | $myapp->perform; | ||
| 102 | |||
| 103 | The perform method is meant to be implemented by a subclass and is | ||
| 104 | automatically invoked iteratively by the event-loop. | ||
| 105 | |||
| 106 | =cut | ||
| 107 | |||
| 108 | =head2 receive | ||
| 109 | |||
| 110 | # given: synopsis | ||
| 111 | |||
| 112 | $myapp->receive($myapp->name, { task => 'fuzzy_logic' }); | ||
| 113 | |||
| 114 | The receive method is meant to be implemented by a subclass and is | ||
| 115 | automatically invoked iteratively by the event-loop whenever a process receives | ||
| 116 | a message in its mailbox. | ||
| 117 | |||
| 118 | =cut | ||
| 119 | |||
| 120 | =head1 AUTHOR | ||
| 121 | |||
| 122 | Al Newkirk, C<awncorp@cpan.org> | ||
| 123 | |||
| 124 | =head1 LICENSE | ||
| 125 | |||
| 126 | Copyright (C) 2011-2019, Al Newkirk, et al. | ||
| 127 | |||
| 128 | This is free software; you can redistribute it and/or modify it under the terms | ||
| 129 | of the The Apache License, Version 2.0, as elucidated in the L<"license | ||
| 130 | file"|https://github.com/iamalnewkirk/zing/blob/master/LICENSE>. | ||
| 131 | |||
| 132 | =head1 PROJECT | ||
| 133 | |||
| 134 | L<Wiki|https://github.com/iamalnewkirk/zing/wiki> | ||
| 135 | |||
| 136 | L<Project|https://github.com/iamalnewkirk/zing> | ||
| 137 | |||
| 138 | L<Initiatives|https://github.com/iamalnewkirk/zing/projects> | ||
| 139 | |||
| 140 | L<Milestones|https://github.com/iamalnewkirk/zing/milestones> | ||
| 141 | |||
| 142 | L<Contributing|https://github.com/iamalnewkirk/zing/blob/master/CONTRIBUTE.md> | ||
| 143 | |||
| 144 | L<Issues|https://github.com/iamalnewkirk/zing/issues> | ||
| 145 | |||
| 146 | =cut | ||