AnyEvent-Multilog
view release on metacpan or search on metacpan
lib/AnyEvent/Multilog.pm view on Meta::CPAN
package AnyEvent::Multilog;
# ABSTRACT: event-driven interface to a multilog process
use Moose;
use MooseX::Types::Path::Class qw(File);
use AnyEvent::Subprocess;
use AnyEvent::Subprocess::Job::Delegate::Handle;
our $VERSION = '0.01';
use namespace::autoclean;
has 'multilog' => (
is => 'ro',
isa => File,
predicate => 'has_multilog_path',
coerce => 1,
documentation => q{path to multilog, if you don't want to use $PATH},
);
has 'script' => (
is => 'ro',
isa => 'ArrayRef[Str]',
required => 1,
documentation => 'multilog "script", not escaped for the shell',
);
has '_job' => (
init_arg => undef,
reader => '_job',
lazy => 1,
builder => '_build_job',
);
has 'job_args' => (
is => 'ro',
isa => 'HashRef',
default => sub { +{} },
);
has 'run' => (
init_arg => undef,
reader => 'run',
lazy_build => 1,
);
has 'on_exit' => (
is => 'ro',
isa => 'CodeRef',
predicate => 'has_exit_handler',
documentation => 'optional callback called when multilog exists successfully',
);
has 'on_error' => (
is => 'ro',
isa => 'CodeRef',
predicate => 'has_error_handler',
documentation => 'optional callback called when multilog emits an error',
);
has 'errors' => (
is => 'bare', # uh, no it's not, but mooose bug
init_arg => undef,
traits => ['Array'],
default => sub { [] },
lazy => 1,
handles => {
push_error => 'push',
has_errors => 'count',
errors => 'elements',
},
( run in 0.488 second using v1.01-cache-2.11-cpan-39bf76dae61 )