AnyEvent::Subprocess::Running::Delegate::Callback - the C<Running> part of the Callback delegate


AnyEvent-Subprocess documentation Contained in the AnyEvent-Subprocess distribution.

Index


Code Index:

NAME

Top

AnyEvent::Subprocess::Running::Delegate::Callback - the Running part of the Callback delegate

VERSION

Top

version 1.102912

DESCRIPTION

Top

Calls the completion hook that was setup in the Job delegate, passes saved state to the Done delegate.

AUTHOR

Top

Jonathan Rockway <jrockway@cpan.org>

COPYRIGHT AND LICENSE

Top


AnyEvent-Subprocess documentation Contained in the AnyEvent-Subprocess distribution.

package AnyEvent::Subprocess::Running::Delegate::Callback;
BEGIN {
  $AnyEvent::Subprocess::Running::Delegate::Callback::VERSION = '1.102912';
}
# ABSTRACT: the C<Running> part of the Callback delegate
use Moose;

use AnyEvent::Subprocess::Done::Delegate::State; # name change

with 'AnyEvent::Subprocess::Running::Delegate';

has 'completion_hook' => (
    init_arg => 'completion_hook',
    reader   => '_completion_hook',
    isa      => 'CodeRef',
    default  => sub { sub {} },
    required => 1,
);


has 'state' => (
    is       => 'ro',
    isa      => 'HashRef',
    required => 1,
    default  => sub { +{} },
);

sub completion_hook {
    my ($self, $running, @args) = @_;
    $self->_completion_hook->($self, @args);
}

sub build_done_delegates {
    my ($self) = @_;
    return AnyEvent::Subprocess::Done::Delegate::State->new(
        name  => $self->name,
        state => $self->state,
    );
}
sub build_events {}

__PACKAGE__->meta->make_immutable;

1;




__END__