1MooseX::Workers::Job(3)User Contributed Perl DocumentatioMnooseX::Workers::Job(3)
2
3
4

NAME

6       MooseX::Workers::Job - One of the jobs MooseX::Workers is running
7

SYNOPSIS

9         package Manager;
10         use Moose;
11         with qw(MooseX::Workers);
12
13         sub worker_stdout {
14             my ( $self, $output, $job ) = @_;
15             printf(
16                 "%s(%s,%s) said '%s'\n",
17                 $job->name, $job->ID, $job->PID, $output
18             );
19         }
20         sub run {
21             foreach (qw( foo bar baz )) {
22                 my $job = MooseX::Workers::Job->new(
23                    name    => $_,
24                    command => sub { print "Hello World\n" },
25                    timeout => 30,
26                 );
27                 $_[0]->spawn( $job );
28             }
29             POE::Kernel->run();
30         }
31         no Moose;
32
33         Manager->new()->run();
34         # bar(2,32423) said 'Hello World'
35         # foo(1,32422) said 'Hello World'
36         # baz(3,32424) said 'Hello World'
37

DESCRIPTION

39       MooseX::Workers::Job objects are convenient if you want to name each
40       MooseX::Workers job, or if you want them to timeout (abort) after a
41       certain number of seconds.
42

METHODS

44       The accessors, as well as:
45
46   is_coderef
47       Returns true if the command is some type of coderef, undef otherwise.
48
49
50
51perl v5.36.0                      2022-07-22           MooseX::Workers::Job(3)
Impressum