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

Comparing AnyEvent-Fork/Fork.pm (file contents):
Revision 1.21 by root, Sat Apr 6 03:40:31 2013 UTC vs.
Revision 1.22 by root, Sat Apr 6 05:51:14 2013 UTC

625 ->send_arg ("str3") 625 ->send_arg ("str3")
626 ->run ("Some::function", sub { 626 ->run ("Some::function", sub {
627 my ($fh) = @_; 627 my ($fh) = @_;
628 628
629 # fh is nonblocking, but we trust that the OS can accept these 629 # fh is nonblocking, but we trust that the OS can accept these
630 # extra 3 octets anyway. 630 # few octets anyway.
631 syswrite $fh, "hi #$_\n"; 631 syswrite $fh, "hi #$_\n";
632 632
633 # $fh is being closed here, as we don't store it anywhere 633 # $fh is being closed here, as we don't store it anywhere
634 }); 634 });
635 } 635 }
637 # Some::function might look like this - all parameters passed before fork 637 # Some::function might look like this - all parameters passed before fork
638 # and after will be passed, in order, after the communications socket. 638 # and after will be passed, in order, after the communications socket.
639 sub Some::function { 639 sub Some::function {
640 my ($fh, $str1, $str2, $fh1, $fh2, $str3) = @_; 640 my ($fh, $str1, $str2, $fh1, $fh2, $str3) = @_;
641 641
642 print scalar <$fh>; # prints "hi 1\n" and "hi 2\n" 642 print scalar <$fh>; # prints "hi #1\n" and "hi #2\n" in any order
643 } 643 }
644 644
645=cut 645=cut
646 646
647sub run { 647sub run {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines