--- AnyEvent-Fork-RPC/RPC.pm 2013/04/18 20:27:02 1.19 +++ AnyEvent-Fork-RPC/RPC.pm 2013/04/27 23:49:01 1.24 @@ -2,7 +2,7 @@ AnyEvent::Fork::RPC - simple RPC extension for AnyEvent::Fork -THE API IS NOT FINISHED, CONSIDER THIS A TECHNOLOGY DEMO +THE API IS NOT FINISHED, CONSIDER THIS A BETA RELEASE =head1 SYNOPSIS @@ -307,9 +307,11 @@ use Guard (); use AnyEvent; -use AnyEvent::Fork; # we don't actually depend on it, this is for convenience +# explicit version on next line, as some cpan-testers test with the 0.1 version, +# ignoring dependencies, and this line will at least give a clear indication of that. +use AnyEvent::Fork 0.6; # we don't actually depend on it, this is for convenience -our $VERSION = 0.1; +our $VERSION = 0.2; =item my $rpc = AnyEvent::Fork::RPC::run $fork, $function, [key => value...] @@ -526,7 +528,7 @@ if ($len) { while (8 <= length $rbuf) { - ($id, $len) = unpack "LL", $rbuf; + ($id, $len) = unpack "NN", $rbuf; 8 + $len <= length $rbuf or last; @@ -552,7 +554,8 @@ if (@rcb || %rcb) { $on_error->("unexpected eof"); } else { - $on_destroy->(); + $on_destroy->() + if $on_destroy; } } elsif ($! != Errno::EAGAIN && $! != Errno::EWOULDBLOCK) { undef $rw; undef $ww; # it ends here @@ -578,9 +581,9 @@ $rcb{$id} = pop; - $guard; # keep it alive + $guard if 0; # keep it alive - $wbuf .= pack "LL/a*", $id, &$f; + $wbuf .= pack "NN/a*", $id, &$f; $ww ||= $fh && AE::io $fh, 1, $wcb; } : sub { @@ -588,7 +591,7 @@ $guard; # keep it alive - $wbuf .= pack "L/a*", &$f; + $wbuf .= pack "N/a*", &$f; $ww ||= $fh && AE::io $fh, 1, $wcb; } } @@ -774,6 +777,13 @@ so you might want to look into L which can handle the gory details. +=head1 EXCEPTIONS + +There are no provisions whatsoever for catching exceptions at this time - +in the child, exeptions might kill the process, causing calls to be lost +and the parent encountering a fatal error. In the parent, exceptions in +the result callback will not be caught and cause undefined behaviour. + =head1 SEE ALSO L, to create the processes in the first place.