Permalink
Browse files

isillitoe started asking a MooseX::Workers question.

  • Loading branch information...
1 parent 2f462ae commit 89b5d83cc34824f4c0cc5a3209400f42429c8bbd @jhannah committed May 19, 2010
Showing with 29 additions and 0 deletions.
  1. +29 −0 isillitoe/foo.pl
View
@@ -0,0 +1,29 @@
+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 "Started\n"; sleep(10); print "Finished\n"; die "horribly" },
+ timeout => 30,
+ );
+ $_[0]->enqueue( $job );
+ }
+ POE::Kernel->run();
+}
+
+no Moose;
+
+Manager->new()->run();
+
+

0 comments on commit 89b5d83

Please sign in to comment.