AnyEvent-Subprocess

 view release on metacpan or  search on metacpan

lib/AnyEvent/Subprocess/Job/Delegate/Handle.pm  view on Meta::CPAN

package AnyEvent::Subprocess::Job::Delegate::Handle;
BEGIN {
  $AnyEvent::Subprocess::Job::Delegate::Handle::VERSION = '1.102912';
}
# ABSTRACT: share a filehandle or socket with the child
use AnyEvent;
use AnyEvent::Util qw(portable_pipe portable_socketpair);
use AnyEvent::Subprocess::Handle;
use POSIX qw(dup2);

use MooseX::Types::Moose qw(Str Int GlobRef ArrayRef);
use AnyEvent::Subprocess::Types qw(Direction);

use namespace::autoclean;
use Moose;

with 'AnyEvent::Subprocess::Job::Delegate';

has 'direction' => (
    is            => 'ro',
    isa           => Direction,
    required      => 1,
    documentation => 'r when parent reads a pipe, w when parent writes to a pipe, rw for a socket',
);

has 'name' => (
    is       => 'ro',
    isa      => Str,
    required => 1,
);

has 'replace' => (
    is        => 'ro',
    isa       => GlobRef|Int,
    predicate => 'has_replace',
);

has 'pass_to_child' => (
    is       => 'ro',
    isa      => 'Bool',
    default  => 0,
    required => 1,
);

has 'want_leftovers' => (
    is      => 'ro',
    isa     => 'Bool',
    default => 0,
);

has 'pipes' => (
    traits     => ['NoClone'],
    is         => 'ro',
    isa        => ArrayRef[GlobRef],
    lazy_build => 1,
);

has 'handle_class' => (
    is       => 'ro',
    isa      => 'ClassName',
    required => 1,
    default  => sub {
        require AnyEvent::Subprocess::Handle;
        return 'AnyEvent::Subprocess::Handle';
    },
);

sub __build_handle {
    my ($self, $fh, @rest) = @_;
    return $self->handle_class->new( fh => $fh, @rest );
}

has 'run_delegate_class' => (
    is       => 'ro',



( run in 0.961 second using v1.01-cache-2.11-cpan-39bf76dae61 )