Jonathan Rockway

NAME

AnyEvent::Subprocess::Job::Delegate::Handle - share a filehandle or socket with the child

VERSION

version 1.102912

INITARGS

direction

'r' for a pipe from the child to the parent, 'w' for a pipe from the parent to the child, 'rw' for a socket.

replace

Optional. If specified, can be a Perl filehandle (\*STDERR) or integer fd number (2). This filehandle will be opened to the object created by this delegate in the child. (So if you say direction => 'r', replace => \*STDERR, the parent will be able to read the child's STDERR via this delegate. If you say direction => 'w', replace => 3, then the child can open fd #3 and read from the parent.)

pass_to_child

If you don't want to replace a filehandle or file descriptor number, you can just pass the filehandle object to the child instead. If you set this to true, the child will get its end of the socket or pipe in the argument hash passed to the child coderef. The key will be the same as the name the delegate.

METHODS

handle

This is the AnyEvent::Subprocess::Handle object that you use to communicate with the child. You typically want to push_read and push_write, but all of AnyEvent::Handle's operations are available. See that manpage for further details; there is a lot you can do, and this module makes it all very easy.

AUTHOR

Jonathan Rockway <jrockway@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Jonathan Rockway.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.