| Distributed-Process documentation | Contained in the Distributed-Process distribution. |
Distributed::Process::Worker - a base class for a worker
package MyWorker;
use Distributed::Process::Worker;
our @ISA = qw/ Distributed::Process::Worker /;
sub run {
my $self = shift;
# do useful stuff
}
1;
The tasks that one wishes to run distributedly must be implemented in the run()
method of a class derived from Distributed::Process::Worker. By default,
this in turn derives from Distributed::Process::LocalWorker, so the custom
class also derives from it, and can run "as is" on the client side.
On the server side, the Distributed::Process::Master object changes the
inheritance of Distributed::Process::Worker to make it a subclass of
Distributed::Process::RemoteWorker. The custom worker class thus also
becomes a subclass of it, and is ready to run on the server.
This is called by the D::P::Master object to change the inheritance and
redefind the run() method. run() on the server does not actually run the tasks
defined in the custom worker class, but sends a /run command on the netork
to the connected client.
Cédric Bouvier, <cbouvi@cpan.org>
Please report any bugs or feature requests to
bug-distributed-process@rt.cpan.org, or through the web interface at
http://rt.cpan.org. I will be notified, and then you'll automatically
be notified of progress on your bug as I make changes.
Copyright 2005 Cédric Bouvier, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Distributed-Process documentation | Contained in the Distributed-Process distribution. |
package Distributed::Process::Worker; use warnings; use strict; use Distributed::Process; use Distributed::Process::LocalWorker; our @ISA = qw/ Distributed::Process::LocalWorker /;
sub go_remote { my $self = shift; require Distributed::Process::RemoteWorker; @ISA = qw/ Distributed::Process::RemoteWorker /; $self->SUPER::go_remote(); }
1; # End of Distributed::Process::Worker