NAME
POEx::WorkerPool::Role::Job - Provides a role for common job semantics
VERSION
version 0.092800
SYNOPSIS
class MyJob with POEx::WorkerPool::Role::Job { method init_job { # Implement job initialization across the process boundary here } }
DESCRIPTION
POEx::WorkerPool::Role::Job provides the scaffolding required to execute arbitrary tasks within the POEx::WorkerPool framework. Consuming classes only need to implement init_job, which will be called once on the other side of the process boundary where coderefs, database handles, etc won't have survived.
Use init_job to initialize all of those ephemeral resources necessary for the job and also to populate the steps to the job.
ATTRIBUTES
ID is: ro, isa: Str
This attribute stores the unique ID for the job. By default it uses Data::UUID::create_str()
steps metaclass: Collection::Array, is: ro, isa: ArrayRef[JobStep]
This attribute stores the steps for the job. All jobs must have one step before execution or else a JobError exception will be thrown.
The following provides are defined to access the steps of the job:
{
push => '_enqueue_step',
shift => 'dequeue_step',
count => 'count_steps',
}
METHODS
enqueue_step(JobStep $step)
enqueue_step takes a JobStep and places it into the steps collection and also increments the total_steps counter.
is_multi_step returns (Bool)
A simple convenience method to check if the job has multiple steps
execute_step returns (JobStatus)
execute_step dequeues a step from steps and executes it, building a proper JobStatus return value. If executing the step produces an exception, the exception class is JobError
AUTHOR
Nicholas Perez <nperez@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2009 by Infinity Interactive.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.