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, '-Mblib', '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
waitpid($pid, 0);
is($? >> 8, 0, "$lib loaded ok");
if (@_warnings)
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/FCGI/Request.pm view on Meta::CPAN
stdin_done => 0,
params => {},
params_string => '',
params_done => 0,
used_stderr => 0,
}, $class;
weaken($self->{fcgi});
weaken($self->{connection});
lib/AnyEvent/FCGI/Request.pm view on Meta::CPAN
my ($self, $data) = @_;
$self->_print_stream($data, AnyEvent::FCGI->FCGI_STDOUT);
}
=head2 print_stderr($data)
This method appends the given data to the STDERR stream of the FastCGI
request, sending it to the webserver.
=cut
sub print_stderr {
my ($self, $data) = @_;
$self->{used_stderr} = 1;
$self->_print_stream($data, AnyEvent::FCGI->FCGI_STDERR);
}
=head2 finish
lib/AnyEvent/FCGI/Request.pm view on Meta::CPAN
$self->_send_record({
request_id => $self->{id},
type => AnyEvent::FCGI->FCGI_STDERR,
content => '',
}) if $self->{used_stderr};
$self->_send_record({
request_id => $self->{id},
type => AnyEvent::FCGI->FCGI_END_REQUEST,
content => pack('Ncccc', 0, AnyEvent::FCGI->FCGI_REQUEST_COMPLETE, 0, 0, 0),
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent/FDpasser.pm view on Meta::CPAN
=head1 SEE ALSO
L<The AnyEvent::FDpasser github repo|https://github.com/hoytech/AnyEvent-FDpasser>
This module gets its name from L<File::FDpasser> which does roughly the same thing as this module except this module provides a non-blocking interface, buffers the sending and receiving of descriptors, doesn't lose descriptors in the event of a full ...
L<Socket::PassAccessRights> is another module similar to File::FDpasser. It supports BSD4.3 and BSD4.4 interfaces.
L<Sprocket::Util::FDpasser> is an example of a non-blocking interface to File::FDpasser. It is based on L<POE> whereas this module is (obviously) based on AnyEvent.
view all matches for this distribution
view release on metacpan or search on metacpan
- NcFTPd
- syst
- SYST
- ALLO
- standalone
- stderr
- auth
- cred
- inet
- pam
- readonly
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
')
->send_fh ($output)
->send_arg ("/bin/echo", "hi")
->run ("run", my $cv = AE::cv);
my $stderr = $cv->recv;
=head2 For stingy users: put the worker code into a C<DATA> section.
When you want to be stingy with files, you can put your code into the
C<DATA> section of your module (or program):
(for example, the C<require> method uses it). It's not supposed to be used
to completely take over the process, use C<run> for that.
The code will usually be executed after this call returns, and there is no
way to pass anything back to the calling process. Any evaluation errors
will be reported to stderr and cause the process to exit.
If you want to execute some code (that isn't in a module) to take over the
process, you should compile a function via C<eval> first, and then call
it via C<run>. This also gives you access to any arguments passed via the
C<send_xxx> methods, such as file handles. See the L<use AnyEvent::Fork as
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/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', '-c', $_ );
});
s!\s*\z!!
for ($stdout, $stderr);
if( $exit ) {
diag $stderr;
diag "Exit code: ", $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