The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Distributed::Process::LocalWorker - a base class for Distributed::Process::Worker when running on the client side.

DESCRIPTION

This class implements the methods declared in D::P::BaseWorker as they should work on the client side.

Methods

time NAME, LIST

Runs the method NAME with LIST as arguments, while measuring its run time. Returns whatever the NAME method returns and appends to the result() a string of the form:

    Time for running NAME: n.nnnnn seconds
reset_result

Empties the stack of results.

result LIST
result

When called with a non-empty LIST of arguments, pushes LIST onto the stack of results. These results are meant to be sent back when the server requests them. Each line in LIST is first prepended with a timestamp of the form YYYYMMDD-HHMMSS).

When called without any arguments, returns the list of results.

synchro TOKEN

Sends the command /synchro TOKEN to the server and waits until the server replies with the same /synchro command before returning. The server should reply only when all the connected clients have sent the same /synchro command. TOKEN is only a identification string, mainly useful for logging purposes.

delay TOKEN

This works much the same way as synchro() but the server replies to each client one after the other, and waiting for some (configurable) time between each one. See Distributed::Process::Master for details.

run_on_server NAME, LIST

Sends a /run_method command to let the server invoke the method named NAME with LIST as argument on its instance of the worker. This instance, running on the server, has its inheritance dynamically changed, so that it derives from D::P::RemoteWorker instead of D::P::LocalWorker. Besides this, all its methods are available.

When developping a subclass to D::P::Worker, one should probably create methods that run on the client and methods that run on the server. It is unlikely to need to run one of the methods on both the server side and the client side.

Attributes

The following list describes the attributes of this class. They must only be accessed through their accessors. When called with an argument, the accessor methods set their attribute's value to that argument and return its former value. When called without arguments, they return the current value.

client

The D::P::Client object which handles the network connection for this worker.

SEE ALSO

Distributed::Process::BaseWorker, Distributed::Process::RemoteWorker, Distributed::Process::Worker

AUTHOR

Cédric Bouvier, <cbouvi@cpan.org>

BUGS

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.

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

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.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 196:

Non-ASCII character seen before =encoding in 'Cédric'. Assuming UTF-8