ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-Fork-RPC/RPC.pm
(Generate patch)

Comparing AnyEvent-Fork-RPC/RPC.pm (file contents):
Revision 1.15 by root, Thu Apr 18 13:15:23 2013 UTC vs.
Revision 1.19 by root, Thu Apr 18 20:27:02 2013 UTC

1=head1 NAME 1=head1 NAME
2 2
3AnyEvent::Fork::RPC - simple RPC extension for AnyEvent::Fork 3AnyEvent::Fork::RPC - simple RPC extension for AnyEvent::Fork
4
5THE API IS NOT FINISHED, CONSIDER THIS A TECHNOLOGY DEMO
4 6
5=head1 SYNOPSIS 7=head1 SYNOPSIS
6 8
7 use AnyEvent::Fork::RPC; 9 use AnyEvent::Fork::RPC;
8 # use AnyEvent::Fork is not needed 10 # use AnyEvent::Fork is not needed
11 ->new 13 ->new
12 ->require ("MyModule") 14 ->require ("MyModule")
13 ->AnyEvent::Fork::RPC::run ( 15 ->AnyEvent::Fork::RPC::run (
14 "MyModule::server", 16 "MyModule::server",
15 ); 17 );
18
19 use AnyEvent;
16 20
17 my $cv = AE::cv; 21 my $cv = AE::cv;
18 22
19 $rpc->(1, 2, 3, sub { 23 $rpc->(1, 2, 3, sub {
20 print "MyModule::server returned @_\n"; 24 print "MyModule::server returned @_\n";
559 $ww ||= AE::io $fh, 1, $wcb; 563 $ww ||= AE::io $fh, 1, $wcb;
560 }); 564 });
561 565
562 my $guard = Guard::guard { 566 my $guard = Guard::guard {
563 $shutdown = 1; 567 $shutdown = 1;
564 $ww ||= $fh && AE::io $fh, 1, $wcb; 568
569 shutdown $fh, 1 if $fh && !$ww;
565 }; 570 };
566 571
567 my $id; 572 my $id;
568 573
569 $arg{async} 574 $arg{async}
769so you might want to look into L<AnyEvent::FDpasser> which can handle the 774so you might want to look into L<AnyEvent::FDpasser> which can handle the
770gory details. 775gory details.
771 776
772=head1 SEE ALSO 777=head1 SEE ALSO
773 778
774L<AnyEvent::Fork> (to create the processes in the first place), 779L<AnyEvent::Fork>, to create the processes in the first place.
780
775L<AnyEvent::Fork::Pool> (to manage whole pools of processes). 781L<AnyEvent::Fork::Pool>, to manage whole pools of processes.
776 782
777=head1 AUTHOR AND CONTACT INFORMATION 783=head1 AUTHOR AND CONTACT INFORMATION
778 784
779 Marc Lehmann <schmorp@schmorp.de> 785 Marc Lehmann <schmorp@schmorp.de>
780 http://software.schmorp.de/pkg/AnyEvent-Fork-RPC 786 http://software.schmorp.de/pkg/AnyEvent-Fork-RPC

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines