[Moose-commits] r7221 - in MooseX-Workers/trunk: lib/MooseX t
perigrin at code2.0beta.co.uk
perigrin at code2.0beta.co.uk
Thu Jan 1 04:34:11 GMT 2009
Author: perigrin
Date: 2008-12-31 20:34:11 -0800 (Wed, 31 Dec 2008)
New Revision: 7221
Modified:
MooseX-Workers/trunk/lib/MooseX/Workers.pm
MooseX-Workers/trunk/t/01.worker.t
Log:
get tests passing and update synopsis
Modified: MooseX-Workers/trunk/lib/MooseX/Workers.pm
===================================================================
--- MooseX-Workers/trunk/lib/MooseX/Workers.pm 2009-01-01 04:34:03 UTC (rev 7220)
+++ MooseX-Workers/trunk/lib/MooseX/Workers.pm 2009-01-01 04:34:11 UTC (rev 7221)
@@ -28,7 +28,7 @@
return $self->Engine->call( add_worker => $cmd => $args );
}
-meta->alias_method( 'fork' => __PACKAGE__->can('spawn') );
+__PACKAGE__->meta->alias_method( 'fork' => __PACKAGE__->can('spawn') );
sub run_command {
my ( $self, $cmd ) = @_;
@@ -59,23 +59,24 @@
use Moose;
with qw(MooseX::Workers);
- sub run {
- $_[0]->spawn(sub { sleep 500; print "Hello World\n"});
+ sub run {
+ $_[0]->spawn( sub { sleep 3; print "Hello World\n" } );
warn "Running now ... ";
+ POE::Kernel->run();
}
# Implement our Interface
sub worker_manager_start { warn 'started worker manager' }
sub worker_manager_stop { warn 'stopped worker manager' }
sub max_workers_reached { warn 'maximum worker count reached' }
-
+
sub worker_stdout { shift; warn join ' ', @_; }
sub worker_stderr { shift; warn join ' ', @_; }
sub worker_error { shift; warn join ' ', @_; }
sub worker_done { shift; warn join ' ', @_; }
sub worker_started { shift; warn join ' ', @_; }
sub sig_child { shift; warn join ' ', @_; }
- no Moose;
+ no Moose;
Manager->new->run();
Modified: MooseX-Workers/trunk/t/01.worker.t
===================================================================
--- MooseX-Workers/trunk/t/01.worker.t 2009-01-01 04:34:03 UTC (rev 7220)
+++ MooseX-Workers/trunk/t/01.worker.t 2009-01-01 04:34:11 UTC (rev 7221)
@@ -28,9 +28,12 @@
sub worker_done { ::pass('worker done') }
sub worker_started { ::pass('worker started') }
+
+ sub run {
+ $_[0]->spawn( sub { print "HELLO\n"; print STDERR "WORLD\n" } );
+ POE::Kernel->run();
+ }
no Moose;
}
-my $m = Manager->new();
-$m->spawn( sub { print "HELLO\n"; print STDERR "WORLD\n" } );
-POE::Kernel->run();
+Manager->new()->run();
More information about the Moose-commits
mailing list