Permalink
Browse files

Added SYSOPSIS

  • Loading branch information...
1 parent 62cef51 commit 43c91c0859a35785f361603be5a4bcd1a71d6049 @agorman agorman committed Apr 27, 2011
Showing with 34 additions and 1 deletion.
  1. +34 −1 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();

0 comments on commit 43c91c0

Please sign in to comment.