AnyEvent-Fork-RPC
view release on metacpan or search on metacpan
The above could be used like this:
my $rpc = AnyEvent::Fork
->new
->require ("MyWorker")
->AnyEvent::Fork::RPC::run ("My::Arith::run",
on_error => ..., on_event => ..., on_destroy => ...,
);
$rpc->(add => 1, 3, Coro::rouse_cb); say Coro::rouse_wait;
$rpc->(mul => 3, 2, Coro::rouse_cb); say Coro::rouse_wait;
The "say"'s will print 4 and 6.
Example 4: Forward AnyEvent::Log messages using "on_event"
This partial example shows how to use the "event" function to forward
AnyEvent::Log messages to the parent.
For this, the parent needs to provide a suitable "on_event":
->AnyEvent::Fork::RPC::run (
The above could be used like this:
my $rpc = AnyEvent::Fork
->new
->require ("MyWorker")
->AnyEvent::Fork::RPC::run ("My::Arith::run",
on_error => ..., on_event => ..., on_destroy => ...,
);
$rpc->(add => 1, 3, Coro::rouse_cb); say Coro::rouse_wait;
$rpc->(mul => 3, 2, Coro::rouse_cb); say Coro::rouse_wait;
The C<say>'s will print C<4> and C<6>.
=head2 Example 4: Forward AnyEvent::Log messages using C<on_event>
This partial example shows how to use the C<event> function to forward
L<AnyEvent::Log> messages to the parent.
For this, the parent needs to provide a suitable C<on_event>:
( run in 0.344 second using v1.01-cache-2.11-cpan-483215c6ad5 )