Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added SYSOPSIS

  • Loading branch information...
commit 43c91c0859a35785f361603be5a4bcd1a71d6049 1 parent 62cef51
@agorman agorman authored
Showing with 34 additions and 1 deletion.
  1. +34 −1 lib/Reflexive/WorkerPool.pm
View
35 lib/Reflexive/WorkerPool.pm
@@ -71,4 +71,37 @@ sub _build_workers {
return \@workers;
}
-1;
+1;
+
+__END__
+
+=head1 SYNOPSIS
+
+{
+ package MyJob;
+ use Moose;
+ extends 'Reflex::Base';
+ with 'Reflex::Role::Collectible';
+ with 'Reflexive::WorkerPool::Role::Job';
+
+ sub work {
+ my $self = shift;
+
+ # doing a unit of work!
+ }
+}
+
+
+use Reflexive::WorkerPool;
+
+my $worker_pool = Reflexive::WorkerPool->new();
+
+for my $i (0..10) {
+ try {
+ $worker_pool->enqueue_job(MyJob->new);
+ } catch {
+ warn "Oh noes! bad stuff happened: $_\n";
+ };
+}
+
+$worker_pool->run_all();
Please sign in to comment.
Something went wrong with that request. Please try again.