MooseX:...rs::Job(3)
π MooseX::Workers::Job π
okay bestie so real talk β this page is from the User Contributed Perl Documentation collection, it's MooseX::Workers::Job(3), and it is exactly what it sounds like. let's get into it π«Ά
β¨ NAME β¨
MooseX::Workers::Job β literally just one of the jobs that MooseX::Workers is out here running. one job. that's the whole thing. no cap. π
β¨ SYNOPSIS β¨
here's the vibe, copy it, love it, run it:
package Manager;
use Moose;
with qw(MooseX::Workers);
sub worker_stdout {
my ( $self, $output, $job ) = @_;
printf(
"%s(%s,%s) said '%s'\n",
$job->name, $job->ID, $job->PID, $output
);
}
sub run {
foreach (qw( foo bar baz )) {
my $job = MooseX::Workers::Job->new(
name => $_,
command => sub { print "Hello World\n" },
timeout => 30,
);
$_[0]->spawn( $job );
}
POE::Kernel->run();
}
no Moose;
Manager->new()->run();
# bar(2,32423) said 'Hello World'
# foo(1,32422) said 'Hello World'
# baz(3,32424) said 'Hello World'
notice how the output order is not the order you spawned them? yeah. that's the whole point of workers, bestie. they do their own thing on their own time π¦β¨
β¨ DESCRIPTION β¨
so like, MooseX::Workers::Job objects are the move when you want to name each MooseX::Workers job, or when you want a job to timeout (abort) after a certain number of seconds. like a "you have 30 seconds to slay or you're done" situation. iconic behavior honestly π
β¨ METHODS β¨
the accessors, plus this one extra method:
is_coderef
returns true if the command is some type of coderef β and undef otherwise. that's it. that's the method. π
heads up bestie: this is aMooseX::Workerscompanion class, so if you don't already know your way aroundMooseX::Workers, maybe go read that one first? no pressure tho π
and that's the whole page!! ty for reading my little manpage rant, go name your jobs and set your timeouts, mwah ππ
this page shipped with perl v5.42.0, dated 2025-07-25 β so yeah, it's giving fresh, it's giving maintained, periodt πβ
π¦ where this page comes from
- fedora 43: perl-MooseX-Workers 0.24-33.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms