1MooseX::Workers::EngineU(s3e)r Contributed Perl DocumentaMtoioosneX::Workers::Engine(3)
2
3
4

NAME

6       MooseX::Workers::Engine - Provide the workhorse to MooseX::Workers
7

SYNOPSIS

9           package MooseX::Workers;
10
11           has Engine => (
12               isa      => 'MooseX::Workers::Engine',
13               is       => 'ro',
14               lazy     => 1,
15               required => 1,
16               default  => sub { MooseX::Workers::Engine->new( visitor => $_[0] ) },
17               handles  => [
18                   qw(
19                     max_workers
20                     has_workers
21                     num_workers
22                     put_worker
23                     kill_worker
24                     )
25               ],
26           );
27

DESCRIPTION

29       MooseX::Workers::Engine provides the main functionality to
30       MooseX::Workers. It wraps a POE::Session and
31

ATTRIBUTES

33       visitor
34           Hold a reference to our main object so we can use the callbacks on
35           it.
36
37       max_workers
38           An Integer specifying the maxium number of workers we have.
39
40       workers
41           An ArrayRef of POE::Wheel::Run objects that are our workers.
42
43       session
44           Contains the POE::Session that controls the workers.
45

METHODS

47       yield
48           Helper method to post events to our internal manager session.
49
50       call
51           Helper method to call events to our internal manager session.  This
52           is synchronous and will block incoming data from the children if it
53           takes too long  to return.
54
55       set_worker($key)
56           Set the worker at $key
57
58       get_worker($key)
59           Retrieve the worker at $key
60
61       delete_worker($key)
62           Remove the worker atx $key
63
64       has_workers
65           Check to see if we have *any* workers currently. This is delegated
66           to the MooseX::Workers::Engine object.
67
68       num_workers
69           Return the current number of workers. This is delegated to the
70           MooseX::Workers::Engine object.
71
72       has_manager
73           Check to see if we have a manager session.
74
75       remove_manager
76           Remove the manager session.
77
78       meta
79           The Metaclass for MooseX::Workers::Engine see Moose's
80           documentation.
81

EVENTS

83       add_worker ($command)
84           Create a POE::Wheel::Run object to handle $command. If $command
85           holds a scalar, it will be executed as exec($scalar).  Shell
86           metacharacters will be expanded in this form. If $command holds an
87           array reference, it will executed as exec(@$array). This form of
88           exec() doesn't expand shell metacharacters.  If $command holds a
89           code reference, it will be called in the forked child process, and
90           then the child will exit.
91
92           See POE::Wheel::Run for more details.
93

INTERFACE

95       MooseX::Worker::Engine fires the following callbacks:
96
97       worker_manager_start
98           Called when the managing session is started
99
100       worker_manager_stop
101           Called when the managing session stops
102
103       max_workers_reached
104           Called when we reach the maximum number of workers
105
106       worker_stdout
107           Called when a child prints to STDOUT
108
109       worker_stderr
110           Called when a child prints to STDERR
111
112       worker_error
113           Called when there is an error condition detected with the child.
114
115       worker_done
116           Called when a worker completes $command
117
118       worker_started
119           Called when a worker starts $command
120
121       sig_child($PID, $ret)
122           Called when the mangaging session recieves a SIG CHDL event
123

AUTHOR

125       Chris Prather  "<perigrin@cpan.org>"
126
128       Copyright (c) 2007, Chris Prather "<perigrin@cpan.org>". All rights
129       reserved.
130
131       This module is free software; you can redistribute it and/or modify it
132       under the same terms as Perl itself. See perlartistic.
133

DISCLAIMER OF WARRANTY

135       BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
136       FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
137       WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
138       PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
139       EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
140       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
141       ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
142       YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
143       NECESSARY SERVICING, REPAIR, OR CORRECTION.
144
145       IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
146       WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
147       REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
148       TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
149       CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
150       SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
151       RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
152       FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
153       SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
154       DAMAGES.
155
156
157
158perl v5.12.0                      2009-04-27        MooseX::Workers::Engine(3)
Impressum