… | |
… | |
435 | # send string |
435 | # send string |
436 | my $len = syswrite $self->[FH], $self->[QUEUE][0]; |
436 | my $len = syswrite $self->[FH], $self->[QUEUE][0]; |
437 | |
437 | |
438 | unless ($len) { |
438 | unless ($len) { |
439 | return if $! == Errno::EAGAIN || $! == Errno::EWOULDBLOCK; |
439 | return if $! == Errno::EAGAIN || $! == Errno::EWOULDBLOCK; |
440 | undef $self->[3]; |
440 | undef $self->[WW]; |
441 | die "AnyEvent::Fork: command write failure: $!"; |
441 | die "AnyEvent::Fork: command write failure: $!"; |
442 | } |
442 | } |
443 | |
443 | |
444 | substr $self->[QUEUE][0], 0, $len, ""; |
444 | substr $self->[QUEUE][0], 0, $len, ""; |
445 | shift @{ $self->[QUEUE] } unless length $self->[QUEUE][0]; |
445 | shift @{ $self->[QUEUE] } unless length $self->[QUEUE][0]; |
… | |
… | |
774 | |
774 | |
775 | $self->[CB] = $cb; |
775 | $self->[CB] = $cb; |
776 | $self->_cmd (r => $func); |
776 | $self->_cmd (r => $func); |
777 | } |
777 | } |
778 | |
778 | |
779 | =item $proc->to_fh ($cb->($fh)) |
779 | =item $proc->to_fh ($cb->($fh)) # EXPERIMENTAL, MIGHT BE REMOVED |
780 | |
780 | |
781 | Flushes all commands out to the process and then calls the callback with |
781 | Flushes all commands out to the process and then calls the callback with |
782 | the communications socket. |
782 | the communications socket. |
783 | |
783 | |
784 | The process object becomes unusable on return from this function - any |
784 | The process object becomes unusable on return from this function - any |
… | |
… | |
800 | $self->[CB]->($self->[FH]); |
800 | $self->[CB]->($self->[FH]); |
801 | @$self = (); |
801 | @$self = (); |
802 | } |
802 | } |
803 | } |
803 | } |
804 | |
804 | |
805 | =item new_from_fh AnyEvent::Fork $fh |
805 | =item new_from_fh AnyEvent::Fork $fh # EXPERIMENTAL, MIGHT BE REMOVED |
806 | |
806 | |
807 | Takes a file handle originally rceeived by the C<to_fh> method and creates |
807 | Takes a file handle originally rceeived by the C<to_fh> method and creates |
808 | a new C<AnyEvent:Fork> object. The child process itself will not change in |
808 | a new C<AnyEvent:Fork> object. The child process itself will not change in |
809 | any way, i.e. it will keep all the modifications done to it before calling |
809 | any way, i.e. it will keep all the modifications done to it before calling |
810 | C<to_fh>. |
810 | C<to_fh>. |