AnyEvent-Open3-Simple
view release on metacpan or search on metacpan
cannot be used a drop in replacement for that module.
There are already a number of interfaces for interacting with
subprocesses in the context of AnyEvent, but this one is the most
convenient for my usage. Note the modules listed in the SEE ALSO
section below for other interfaces that may be more or less
appropriate.
CONSTRUCTOR
Constructor takes a hash or hashref of event callbacks and attributes.
Event callbacks have an on_ prefix, attributes do not.
ATTRIBUTES
* implementation
The implementation to use for detecting process termination. This
should be one of child, idle or mojo. On all platforms except for
Microsoft Windows (but not Cygwin) the default is child.
You can change the default by setting the ANYEVENT_OPEN3_SIMPLE
as its only argument. For example:
foreach my $i (1..10)
{
$ipc->run($prog, @args, \$stdin, sub {
my($proc) = @_;
$proc->user({ iteration => $i });
});
}
This is useful for making data accessible to $ipc object's callbacks
that may be out of scope otherwise.
CAVEATS
Some AnyEvent implementations may not work properly with the method
used by AnyEvent::Open3::Simple to wait for the child process to
terminate. See "CHILD PROCESS WATCHERS" in AnyEvent for details.
This module uses an idle watcher instead of a child watcher to detect
program termination on Microsoft Windows (but not Cygwin). This is
$cv->recv;
This will cause the recv to die, printing a useful diagnostic if the
exception isn't caught somewhere else.
SEE ALSO
AnyEvent::Open3::Simple::Process
Represents a process being run by this module, typically passed into
the callbacks.
AnyEvent::Subprocess
Alternative to this module.
AnyEvent::Run
Alternative to this module.
AUTHOR
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
although this module does provides a somewhat different API, so it
cannot be used a drop in replacement for that module.
There are already a number of interfaces for interacting with subprocesses
in the context of L<AnyEvent>, but this one is the most convenient for my
usage. Note the modules listed in the SEE ALSO section below for other
interfaces that may be more or less appropriate.
=head1 CONSTRUCTOR
Constructor takes a hash or hashref of event callbacks and attributes.
Event callbacks have an C<on_> prefix, attributes do not.
=head2 ATTRIBUTES
=over 4
=item * implementation
The implementation to use for detecting process termination. This should
be one of C<child>, C<idle> or C<mojo>. On all platforms except for Microsoft
Windows (but not Cygwin) the default is C<child>.
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
argument. For example:
foreach my $i (1..10)
{
$ipc->run($prog, @args, \$stdin, sub {
my($proc) = @_;
$proc->user({ iteration => $i });
});
}
This is useful for making data accessible to C<$ipc> object's callbacks that may
be out of scope otherwise.
=head1 CAVEATS
Some AnyEvent implementations may not work properly with the method
used by AnyEvent::Open3::Simple to wait for the child process to
terminate. See L<AnyEvent/"CHILD PROCESS WATCHERS"> for details.
This module uses an idle watcher instead of a child watcher to detect
program termination on Microsoft Windows (but not Cygwin). This is
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
This will cause the C<recv> to die, printing a useful diagnostic
if the exception isn't caught somewhere else.
=head1 SEE ALSO
=over 4
=item L<AnyEvent::Open3::Simple::Process>
Represents a process being run by this module, typically passed
into the callbacks.
=item L<AnyEvent::Subprocess>
Alternative to this module.
=item L<AnyEvent::Run>
Alternative to this module.
=back
lib/AnyEvent/Open3/Simple/Process.pm view on Meta::CPAN
=head2 user
Version 0.77
$proc->user($user_data);
my $user_data = $proc->user;
Get or set user defined data tied to the process object. Any
Perl data structure may be used. Useful for persisting data
between callbacks, for example:
AnyEvent::Open3::Simple->new(
on_start => sub {
my($proc) = @_;
$proc->user({ prefix => '> ' });
},
on_stdout => sub {
my($proc, $line) = @_;
my $prefix = $proc->user->{prefix};
say "$prefix$line";
xt/author/pod_spelling_system.t view on Meta::CPAN
Ollis
Mojolicious
plicease
CPAN
reinstall
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
UDP
IP
API
MSWin32
OpenBSD
( run in 1.333 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )