… | |
… | |
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 | |
647 | sub run { |
647 | sub run { |