--- AnyEvent-Fork-RPC/RPC.pm 2013/04/17 19:38:25 1.4 +++ AnyEvent-Fork-RPC/RPC.pm 2013/04/17 20:19:41 1.7 @@ -4,8 +4,8 @@ =head1 SYNOPSIS - use AnyEvent::Fork; use AnyEvent::Fork::RPC; + # use AnyEvent::Fork is not needed my $rpc = AnyEvent::Fork ->new @@ -36,6 +36,9 @@ It also implements an asynchronous event mechanism from the child to the parent, that could be used for progress indications or other information. +Loading this module also always loads L, so you can make a +separate C if you wish, but you don't have to. + =head1 EXAMPLES =head2 Synchronous Backend @@ -57,6 +60,7 @@ ->new ->require ("MyWorker") ->AnyEvent::Fork::RPC::run ("MyWorker::run", + on_error => sub { warn "FATAL: $_[0]"; exit 1 }, on_event => sub { warn "$_[0] requests handled\n" }, on_destroy => $done, ); @@ -104,7 +108,7 @@ Eventually it returns the status value true if the command was successful, or the status value 0 and the stringified error message. -On my system, running the first cdoe fragment with the given +On my system, running the first code fragment with the given F in the current directory yields: /tmp/somepath/1: No such file or directory @@ -151,7 +155,7 @@ use Guard (); use AnyEvent; -#use AnyEvent::Fork; +use AnyEvent::Fork; # we don't actually depend on it, this is for convenience our $VERSION = 0.1; @@ -199,7 +203,7 @@ been successfully handled. This is useful when you queue some requests and want the child to go away after it has handled them. The problem is that the parent must not exit either until all requests have been handled, and -this cna be accomplished by waiting for this callback. +this can be accomplished by waiting for this callback. =item init => $function (default none) @@ -232,7 +236,7 @@ synchronous, and C for asynchronous mode. If you use a template process and want to fork both sync and async -children, then it is permissible to laod both modules. +children, then it is permissible to load both modules. =item serialiser => $string (default: '(sub { pack "(w/a*)*", @_ }, sub { unpack "(w/a*)*", shift })') @@ -309,7 +313,7 @@ my $len = sysread $fh, $rbuf, $rlen - length $rbuf, length $rbuf; if ($len) { - while (5 <= length $rbuf) { + while (4 <= length $rbuf) { $len = unpack "L", $rbuf; 4 + $len <= length $rbuf or last;