view release on metacpan or search on metacpan
lib/AnyEvent/Git/Wrapper.pm view on Meta::CPAN
my @out;
my @err;
my $ipc = AnyEvent::Open3::Simple->new(
on_stdout => \@out,
on_stderr => \@err,
on_error => sub {
#my($error) = @_;
$cv->croak(
Git::Wrapper::Exception->new(
output => \@out,
lib/AnyEvent/Git/Wrapper.pm view on Meta::CPAN
For most commands (all those but C<status>, C<log> and C<version>), the result comes back via the
C<recv> method on the condition variable as two array references, one representing the standard out
and the other being the standard error. Because C<recv> will return just the first value if
called in scalar context, you can retrieve just the output by calling C<recv> in scalar context.
# ignoring stderr
$git->branch(sub {
my $out = shift->recv;
foreach my $line (@$out)
{
...
}
});
# same thing, but saving stderr
$git->branch(sub {
my($out, $err) = shit->recv;
foreach my $line(@$out)
{
...
lib/AnyEvent/Git/Wrapper.pm view on Meta::CPAN
$git->RUN($command, @arguments);
# non-blocking callback
$git->RUN($command, @arguments, sub {
# $out is a list ref of stdout
# $err is a list ref of stderr
my($out, $err) = shift->recv;
});
# non-blocking cv
my $cv = $git->RUN($command, @arguments, AE::cv);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base/Filter.pm view on Meta::CPAN
untie *STDOUT;
untie *STDERR;
return $return, $@, $out, $err;
}
sub eval_stderr {
$self->assert_scalar(@_);
my $output = '';
Test::Base::tie_output(*STDERR, $output);
CORE::eval(shift);
no warnings;
view all matches for this distribution
view release on metacpan or search on metacpan
- GnuPG/Tie.pm: Removed fork. Tie interface doesn't use another process
anymore.
- test.pl: Made tests to run and tracing controllable via environment
variables.
- GnuPG.pm (send_passphrase): Added check for USERID_HINT from gnupg 1.0.5
(run_gnupg): Close all file descriptors except stdin, stdout, stderr and
status fd. (decrypt,decrypt_postread,decrypt_postwrite): Factored
decrypt process for tie interface. (VERSION): Updated version number to
0.08
- GnuPG/Tie/Sign.pm: New Sign tie mode.
- GnuPG/Tie/ClearSign.pm: New ClearSign tie mode.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Groonga.pm view on Meta::CPAN
$self->_set_timeout( $cv, $args_ref->{timeout} ) if $args_ref->{timeout};
my $cmd_cv = run_cmd $groonga_command,
'>' => \my $stdout,
'2>' => \my $stderr;
$cmd_cv->cb(
sub {
my $json = $stdout;
my $result;
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-compile.t view on Meta::CPAN
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-e', "require q[$lib]"))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { +require blib; blib->VERSION('1.01') };
t/00-compile.t view on Meta::CPAN
@switches = (@switches, split(' ', $1)) if $1;
close $fh and skip("$file uses -T; not testable with PERL5LIB", 1)
if grep { $_ eq '-T' } @switches and $ENV{PERL5LIB};
my $stderr = IO::Handle->new;
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-c', $file))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-c', $file);
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$file compiled ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { +require blib; blib->VERSION('1.01') };
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/pod_spelling_system.t view on Meta::CPAN
add_stopwords(@{ $config->{pod_spelling_system}->{stopwords} });
add_stopwords(qw(
Plicease
stdout
stderr
stdin
subref
loopback
username
os
view all matches for this distribution
view release on metacpan or search on metacpan
xt/99-compile.t view on Meta::CPAN
my $last_version = undef;
sub check {
return if (! m{(\.pm|\.pl) \z}xmsi);
my ($stdout, $stderr, $exit) = capture(sub {
system( $^X, '-Mblib', '-wc', $_ );
});
s!\s*\z!!
for ($stdout, $stderr);
if( $exit ) {
diag $exit;
fail($_);
} elsif( $stderr ne "$_ syntax OK") {
diag $stderr;
fail($_);
} else {
pass($_);
};
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base/Filter.pm view on Meta::CPAN
untie *STDOUT;
untie *STDERR;
return $return, $@, $out, $err;
}
sub eval_stderr {
$self->assert_scalar(@_);
my $output = '';
Test::Base::tie_output(*STDERR, $output);
CORE::eval(shift);
no warnings;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base/Filter.pm view on Meta::CPAN
untie *STDOUT;
untie *STDERR;
return $return, $@, $out, $err;
}
sub eval_stderr {
$self->assert_scalar(@_);
my $output = '';
Test::Base::tie_output(*STDERR, $output);
CORE::eval(shift);
no warnings;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Multilog.pm view on Meta::CPAN
=head2 on_error
Optional.
Coderef to be called when multilog writes something to stderr. It's
assumed that logging can't proceed after something is read from
stderr, so all methods will die regardless of whether or not you
handle this callback. Handling this event lets you proactively spawn
a new logger and kill this one without losing any messages.
Patch welcome to make this automatic. I can't get multilog to die on
my machine.
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-compile.t view on Meta::CPAN
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
if (@_warnings)
{
t/00-compile.t view on Meta::CPAN
my $line = <$fh>;
close $fh and skip("$file isn't perl", 1) unless $line =~ /^#!\s*(?:\S*perl\S*)((?:\s+-\w*)*)(?:\s*#.*)?$/;
my @flags = $1 ? split(' ', $1) : ();
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, @flags, '-c', $file);
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$file compiled ok");
# in older perls, -c output is simply the file portion of the path being tested
if (@_warnings = grep { !/\bsyntax OK$/ }
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-compile.t view on Meta::CPAN
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-e', "require q[$lib]"))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { +require blib; blib->VERSION('1.01') };
t/00-compile.t view on Meta::CPAN
@switches = (@switches, split(' ', $1)) if $1;
close $fh and skip("$file uses -T; not testable with PERL5LIB", 1)
if grep { $_ eq '-T' } @switches and $ENV{PERL5LIB};
my $stderr = IO::Handle->new;
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
$^X, @switches, '-c', $file))
if $ENV{PERL_COMPILE_TEST_DEBUG};
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-c', $file);
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$file compiled ok");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { +require blib; blib->VERSION('1.01') };
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
my $class = shift;
my $args = (reftype($_[0]) || '') eq 'HASH' ? shift : { @_ };
my %self;
croak "stdin passed into AnyEvent::Open3::Simple->new no longer supported" if $args->{stdin};
croak "raw passed into AnyEvent::Open::Simple->new no longer supported" if $args->{raw};
$self{$_} = $args->{$_} || $default_handler for qw( on_stdout on_stderr on_start on_exit on_signal on_fail on_error on_success );
$self{impl} = $args->{implementation}
|| $ENV{ANYEVENT_OPEN3_SIMPLE}
|| _detect();
croak "unknown implementation $self{impl}" unless $self{impl} =~ /^(idle|child|mojo)$/;
$self{impl} = _detect()
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
my $stdin;
$stdin = pop if ref $_[-1];
my($self, $program, @arguments) = @_;
my($child_stdin, $child_stdout, $child_stderr);
$child_stderr = gensym;
local *TEMP;
if(defined $stdin)
{
my $file = File::Temp->new;
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
require Mojo::Reactor;
require Mojo::IOLoop;
require AnyEvent::Open3::Simple::Mojo;
}
my $pid = eval { open3 $child_stdin, $child_stdout, $child_stderr, $program, @arguments };
if(my $error = $@)
{
$self->{on_error}->($error, $program, @arguments);
return;
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
$proc_user->($proc);
$self->{on_start}->($proc, $program, @arguments);
my $watcher_stdout;
my $watcher_stderr;
my $stdout_callback = sub {
my $input = <$child_stdout>;
return unless defined $input;
$input =~ s/(\015?\012|\015)$//;
my $ref = $self->{on_stdout};
ref($ref) eq 'ARRAY' ? push @$ref, $input : $ref->($proc, $input);
};
my $stderr_callback = sub {
my $input = <$child_stderr>;
return unless defined $input;
$input =~ s/(\015?\012|\015)$//;
my $ref = $self->{on_stderr};
ref($ref) eq 'ARRAY' ? push @$ref, $input : $ref->($proc, $input);
};
if(!_is_native_win32() && $self->{impl} =~ /^(idle|child)$/)
{
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
fh => $child_stdout,
poll => 'r',
cb => $stdout_callback,
) unless _is_native_win32();
$watcher_stderr = AnyEvent->io(
fh => $child_stderr,
poll => 'r',
cb => $stderr_callback,
) unless _is_native_win32();
}
my $watcher_child;
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
my $status = $_[1];
my($exit_value, $signal) = ($status >> 8, $status & 127);
$proc->close;
# make sure we consume any stdout and stderr which hasn't
# been consumed yet. This seems to make on_out.t work on
# cygwin
if($self->{raw})
{
local $/;
$self->{on_stdout}->($proc, scalar <$child_stdout>);
$self->{on_stderr}->($proc, scalar <$child_stderr>);
}
else
{
while(!eof $child_stdout)
{
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
$input =~ s/(\015?\012|\015)$//;
my $ref = $self->{on_stdout};
ref($ref) eq 'ARRAY' ? push @$ref, $input : $ref->($proc, $input);
}
while(!eof $child_stderr)
{
my $input = <$child_stderr>;
last unless defined $input;
$input =~ s/(\015?\012|\015)$//;
my $ref = $self->{on_stderr};
ref($ref) eq 'ARRAY' ? push @$ref, $input : $ref->($proc, $input);
}
}
$self->{on_exit}->($proc, $exit_value, $signal);
$self->{on_signal}->($proc, $signal) if $signal > 0;
$self->{on_fail}->($proc, $exit_value) if $exit_value > 0;
$self->{on_success}->($proc) if $signal == 0 && $exit_value == 0;
undef $watcher_stdout;
undef $watcher_stderr;
undef $watcher_child;
undef $proc;
};
if($self->{impl} eq 'mojo')
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
if(_is_native_win32())
{
require IO::Select;
$selout = IO::Select->new($child_stdout);
$selerr = IO::Select->new($child_stderr);
}
my $reactor = Mojo::IOLoop->singleton->reactor;
my $id;
$id = Mojo::IOLoop->recurring(0.25 => sub {
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
$end_cb->(@_);
Mojo::IOLoop->remove($id);
if(_is_native_win32())
{
$stdout_callback->() if $selout->can_read(0);
$stderr_callback->() if $selerr->can_read(0);
}
else
{
$reactor->remove($child_stdout);
$reactor->remove($child_stderr);
}
});
});
}
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
if(_is_native_win32())
{
require IO::Select;
$selout = IO::Select->new($child_stdout);
$selerr = IO::Select->new($child_stderr);
}
$watcher_child = AnyEvent->idle(cb => sub {
if(_is_native_win32())
{
$stdout_callback->() if $selout->can_read(0);
$stderr_callback->() if $selerr->can_read(0);
}
AnyEvent::Open3::Simple::Idle::_watcher($pid, $end_cb);
});
}
else
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
on_stdout => sub {
my $proc = shift; # isa AnyEvent::Open3::Simple::Process
my $line = shift; # string
say 'out: ', $string;
},
on_stderr => sub {
my $proc = shift; # isa AnyEvent::Open3::Simple::Process
my $line = shift; # string
say 'err: ', $line;
},
on_exit => sub {
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
$done->recv;
=head1 DESCRIPTION
This module provides an interface to open3 while running under AnyEvent
that delivers data from stdout and stderr as lines are written by the
subprocess. The interface is reminiscent of L<IPC::Open3::Simple>,
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
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
=item * C<on_stdout> ($proc, $line)
Called on every line printed to stdout by the child process.
=item * C<on_stderr> ($proc, $line)
Called on every line printed to stderr by the child process.
=item * C<on_exit> ($proc, $exit_value, $signal)
Called when the processes completes, either because it called exit,
or if it was killed by a signal.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base/Filter.pm view on Meta::CPAN
untie *STDOUT;
untie *STDERR;
return $return, $@, $out, $err;
}
sub eval_stderr {
$self->assert_scalar(@_);
my $output = '';
Test::Base::tie_output(*STDERR, $output);
CORE::eval(shift);
no warnings;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Proc.pm view on Meta::CPAN
Pipes any output of STDOUT to another handle. C<$peer> maybe another L<AnyEvent::Proc> instance, an L<AnyEvent::Handle>, a L<Coro::Channel>, an object that implements the I<print> method (like L<IO::Handle>, including any subclass), a ScalarRef or a ...
C<$fd> defaults to I<stdout>.
$proc->pipe(stderr => $socket);
=head2 pull($peer)
Pulls any data from another handle to STDIN. C<$peer> maybe another L<AnyEvent::Proc> instance, an L<AnyEvent::Handle>, an L<IO::Handle> (including any subclass), a L<Coro::Channel>, a ScalarRef or a GlobRef.
view all matches for this distribution
view release on metacpan or search on metacpan
t/AnyEvent-Process-Memory-Leak.t view on Meta::CPAN
skip "Devel::SizeMe is required", 1 if $@;
my $initial_size;
for (1..10_000) {
my $arg = rand;
my ( $stdout, $stderr ) = ( '', '' );
my $cv = AnyEvent->condvar;
my $job = AnyEvent::Process->new(
args => [ $arg ],
code => sub { exec 'echo', @_ },
kill_interval => 10,
t/AnyEvent-Process-Memory-Leak.t view on Meta::CPAN
],
\*STDERR => [
qw( pipe > handle ),
[
on_eof => sub { }, # Ignore EOF
on_read => sub { $stderr = $_[0]->rbuf },
on_error => sub { return if $! == EPIPE },
]
],
]
);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/ProcessPool/Process.pm view on Meta::CPAN
if ($self->{limit} && $ps->user->{reqs} <= 0) {
$self->stop;
}
},
on_stderr => sub{
warn "AnyEvent::ProcessPool::Worker: $_[1]\n";
},
on_error => sub{
die "error launching worker process: $_[0]";
},
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-compile.t view on Meta::CPAN
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
if (@_warnings)
{
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/Base/Filter.pm view on Meta::CPAN
untie *STDOUT;
untie *STDERR;
return $return, $@, $out, $err;
}
sub eval_stderr {
$self->assert_scalar(@_);
my $output = '';
Test::Base::tie_output(*STDERR, $output);
CORE::eval(shift);
no warnings;
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-compile.t view on Meta::CPAN
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
if (@_warnings)
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Run.pm view on Meta::CPAN
or croak "can't redirect stdout in child pid $$: $!";
# Redirect STDERR
close STDERR if AnyEvent::WIN32;
open STDERR, ">&" . fileno($parent)
or die "can't redirect stderr in child: $!";
# Make STDOUT and STDERR auto-flush.
select STDERR; $| = 1;
select STDOUT; $| = 1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/SSH2.pm view on Meta::CPAN
my($exit);
$channel->register_handler(SSH2_MSG_CHANNEL_REQUEST,
_make_input_channel_req(\$exit));
my $h = $ssh->{client_handlers};
my($stdout, $stderr);
if (my $r = $h->{stdout}) {
$channel->register_handler("_output_buffer",
$r->{code}, @{ $r->{extra} });
}
else {
$channel->register_handler("_output_buffer", sub {
$stdout .= $_[1]->bytes;
});
}
if (my $r = $h->{stderr}) {
$channel->register_handler("_extended_buffer",
$r->{code}, @{ $r->{extra} });
}
else {
$channel->register_handler("_extended_buffer", sub {
$stderr .= $_[1]->bytes;
});
}
$ssh->debug("Entering interactive session.");
$channel->{cb} = sub {
$cb->($ssh, $stdout, $stderr);
}
}
sub break_client_loop { $_[0]->{ek_client_loopcl_quit_pending} = 1 }
lib/AnyEvent/SSH2.pm view on Meta::CPAN
my $cv = AE::cv;
$cv->begin;
$ssh1->send('sleep 5;hostname' => sub {
my ($ssh, $stdout, $stderr) = @_;
print "$stdout";
$cv->end;
})->connect;
$cv->begin;
$ssh2->send('sleep 1;hostname' => sub {
my ($ssh, $stdout, $stderr) = @_;
print "$stdout";
$cv->end;
})->connect;
$cv->recv;
lib/AnyEvent/SSH2.pm view on Meta::CPAN
my $cv = AE::cv;
$cv->begin;
$ssh->send('sleep 5; echo 5' => sub {
my ($ssh, $stdout, $stderr) = @_;
print "$stdout";
$cv->end;
});
$cv->begin;
$ssh->send('sleep 1; echo 1 ; uptime' => sub {
my ($ssh, $stdout, $stderr) = @_;
print "$stdout";
$cv->end;
});
$ssh->connect;
lib/AnyEvent/SSH2.pm view on Meta::CPAN
æè
ä½ å¯è½æ³æä¸å®å±æ¬¡, æ ¹æ®å䏿¡å½ä»¤çæ¡ä»¶æ¥æ§è¡æå®çå½ä»¤.
my $cv = AE::cv;
$ssh->send('sleep 5; echo 5' => sub {
my ($ssh, $stdout, $stderr) = @_;
print "$stdout";
$ssh->send('sleep 1; echo 1 ; uptime' => sub {
my ($ssh, $stdout, $stderr) = @_;
print "$stdout";
$cv->send;
});
});
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/Subprocess.pm view on Meta::CPAN
take a look. (The documentation for that module also covers that, as
well as how to define your own delegate builders.)
If you are too lazy to look -- there are delegates for giving the
child arbitrary sockets or pipes opened to arbitrary file descriptors
(so you can deal with more than stdin/stdout/stderr and communicate
bidirectionally between the parent and child), there is a delegate for
giving the child a pseudo-tty (which can run complicatged programs,
like emacs!), there is a delegate for capturing any input
automatically, and passing it back to the parent via the C<Done>
object, and there is a delegate for calling functions in the parent
lib/AnyEvent/Subprocess.pm view on Meta::CPAN
callback when the process exits. You can also kill the running
process. That's it. From there, you can add delegates to add more
features. You can add a pipe to share between the parent and the
child. Instead of sharing a pipe, you can have an fd opened to an
arbitrary file descriptor number in the child. You have an infinite
number of these, so you can capture the child's stdout and stderr,
write to its stdin, and also share a socket for out-of-band
communication. You can also open a pipe to the child's fd #5 and
write to it. (This is nice if you are invoking something like C<gpg>
that wants the password written on an arbitrary fd other than 1.)
view all matches for this distribution
view release on metacpan or search on metacpan
t/00-compile.t view on Meta::CPAN
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($?, 0, "$lib loaded ok");
if (@_warnings)
{
view all matches for this distribution
view release on metacpan or search on metacpan
example/jobrunner view on Meta::CPAN
}
my $client = AnyEvent::WebSocket::Client->new;
my $connection = $client->connect("ws://localhost:3000/run")->recv;
# error stdout stderr signal exit
my $done = AnyEvent->condvar;
my $ipc = AnyEvent::Open3::Simple->new(
on_stdout => sub {
my($proc, $line) = @_;
print $line, "\n";
$connection->send(to_json({ type => 'out', data => $line }));
},
on_stderr => sub {
my($proc, $line) = @_;
print STDERR $line, "\n";
$connection->send(to_json({ type => 'err', data => $line }));
},
on_exit => sub {
view all matches for this distribution
view release on metacpan or search on metacpan
PerlIO_save_errno|||
PerlIO_seek||5.007003|
PerlIO_set_cnt||5.007003|
PerlIO_set_ptrcnt||5.007003|
PerlIO_setlinebuf||5.007003|
PerlIO_stderr||5.007003|
PerlIO_stdin||5.007003|
PerlIO_stdout||5.007003|
PerlIO_tell||5.007003|
PerlIO_unread||5.007003|
PerlIO_write||5.007003|
whichsig_sv||5.015004|
whichsig|||
win32_croak_not_implemented|||n
with_queued_errors|||
wrap_op_checker||5.015008|
write_to_stderr|||
xs_boot_epilog|||
xs_handshake|||vn
xs_version_bootcheck|||
yyerror_pvn|||
yyerror_pv|||
view all matches for this distribution
view release on metacpan or search on metacpan
SV *self_rv;
CURL *easy;
curl_mime *mimepost;
AV *held_references;
FILE *redirected_stderr;
int slists_count;
struct curl_slist **slists;
char errbuf[CURL_ERROR_SIZE];
SV *callback;
#endif
/* File handles */
case CURLOPT_STDERR:
{
if (request->redirected_stderr) {
fclose(request->redirected_stderr);
}
request->redirected_stderr = fdopen(dup(SvIV(parameter)), "a");
if (!request->redirected_stderr) {
croak("Cannot set CURLOPT_STDERR: fdopen failed");
}
result = curl_easy_setopt(request->easy, option, request->redirected_stderr);
break;
}
/* Special functions */
case CURLOPT_WRITEFUNCTION:
curl_mime_free(response->mimepost);
}
if (response->held_references) {
SvREFCNT_dec(response->held_references);
}
if (response->redirected_stderr) {
fclose(response->redirected_stderr);
}
if (response->slists) {
int i;
for (i = 0; i < response->slists_count; i++) {
curl_slist_free_all(response->slists[i]);
view all matches for this distribution
view release on metacpan or search on metacpan
more verbose debugging output (decoded flags)
0.14 26. Feb 2002
- fixed a problem that page content of Perl sometimes goes to the
stderr instead of stdout
0.13 9. Jan 2002
- return mapped username, when second request on same connection,
instead of unmapped
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Defaults.pm view on Meta::CPAN
=item C<on_error>
Controls error handling. Allowed values are C<croak> and C<return>.
If the value is C<croak> (the default), the method will I<croak> if an
error occurs. If set to C<return>, the constructor will return a valid
object. The B<httpd> exit status and diagnostics emitted to the stderr
will be available via the B<status> and B<error> methods.
=back
=head2 status
view all matches for this distribution
view release on metacpan or search on metacpan
DnsZone is free software and is released under the Artistic License.
See <http://www.perl.com/language/misc/Artistic.html> for details.
DnsZone is (C) 2001 Thomas Eibner <thomas@stderr.net>
view all matches for this distribution