The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Process::Async::Worker - base class for IO::Async::Loop-using subprocess

VERSION

version 0.003

DESCRIPTION

Provides the base class for a worker implementation.

METHODS

run

Subclasses must provide this method.

 sub run {
  my ($self, $loop) = @_;
  $self->send_command('started');
  $loop->add(my $ua = Net::Async::HTTP->new);
  $ua->GET('http://example.com')->get;
 }

stdio

Accessor for the STDIO IO::Async::Stream.

on_stdio_read

Handler for incoming STDIN events.

By default, this extracts lines and dispatches the first word as cmd_$word method, if available, or calls "on_command" if not found.

Subclasses should override this to provide custom behaviour.

_add_to_loop

Sets up an IO::Async::Stream for STDIO when we're added to the event loop.

INHERITED METHODS

IO::Async::Notifier

add_child, adopt_future, can_event, children, configure, configure_unknown, debug_printf, get_loop, invoke_error, invoke_event, loop, make_event_cb, maybe_invoke_event, maybe_make_event_cb, new, notifier_name, parent, remove_child, remove_from_parent

AUTHOR

Tom Molesworth <cpan@perlsite.co.uk>

LICENSE

Copyright Tom Molesworth 2014-2015. Licensed under the same terms as Perl itself.