view release on metacpan or search on metacpan
lib/Ansible/Util/Run.pm view on Meta::CPAN
version 0.001
=head1 SYNOPSIS
$run = Ansible::Util::Run->new;
( $stdout, $stderr, $exit ) = $run->ansiblePlaybook(playbook => $playbook);
$run = Ansible::Util::Run->new(
vaultPasswordFiles => ['secret1', 'secret2']
);
( $stdout, $stderr, $exit ) = $run->ansiblePlaybook(playbook => $playbook);
=head1 DESCRIPTION
A thin wrapper around the Ansible CLI tools.
lib/Ansible/Util/Run.pm view on Meta::CPAN
Invokes the ansible-playbook command with the specified args.
=head3 usage:
($stdout, $stderr, $exit) =
$run->ansiblePlaybook(playbook => $file,
[extraArgs => $aref],
[confessOnError => $bool],
[wantArrayRefs => $bool]);
=head3 returns:
An array containing the stdout, stderr, and exit status from the
ansible-playbook command.
=head3 args:
=over
lib/Ansible/Util/Run.pm view on Meta::CPAN
=over
=item confessOnError
If the command exits with an error, the call will simply confess with the
output from stderr.
=over
=item type: Bool
lib/Ansible/Util/Run.pm view on Meta::CPAN
=over
=item wantArrayRefs
The stdout and stderr are returned as array refs split across newlines.
=over
=item type: Bool
lib/Ansible/Util/Run.pm view on Meta::CPAN
push @cmd, @$extraArgs if $extraArgs;
push @cmd, $playbook if $playbook;
$self->Spawn->confessOnError($confessOnError);
my ( $stdout, $stderr, $exit ) =
$self->Spawn->capture( cmd => \@cmd, wantArrayRefs => $wantArrayRefs);
return ( $stdout, $stderr, $exit );
}
##############################################################################
# PRIVATE METHODS
##############################################################################
view all matches for this distribution
view release on metacpan or search on metacpan
src/ppport.h view on Meta::CPAN
PerlIO_read||5.007003|
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|
src/ppport.h view on Meta::CPAN
whichsig_sv||5.015004|
whichsig|||
win32_croak_not_implemented|||n
with_queued_errors|||
wrap_op_checker||5.015008|
write_to_stderr|||
xmldump_all_perl|||
xmldump_all|||
xmldump_attr|||
xmldump_eval|||
xmldump_form|||
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Any/Daemon/FCGI/ClientConn.pm view on Meta::CPAN
$request;
}
sub send_response($;$)
{ my ($self, $response, $stderr) = @_;
#XXX Net::Async::FastCGI::Request demonstrates how to catch stdout and
#XXX stderr via ties. We don't use that here: cleanly work with
#XXX HTTP::Message objects... errors are logged locally.
my $req_id = $response->request->request_id;
# Simply "Status: " in front of the Response header will make the whole
# message HTTP::Response into a valid CGI response.
$self->_reply_record(STDOUT => $req_id
, 'Status: '.$response->as_string(CRLF));
$self->_reply_record(STDOUT => $req_id, '');
if($stderr && length $$stderr)
{ $self->_reply_record(STDERR => $req_id, $$stderr);
$self->_reply_record(STDERR => $req_id, '');
}
$self->_fcgi_end_request(REQUEST_COMPLETE => $req_id);
view all matches for this distribution
view release on metacpan or search on metacpan
xt/author/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') };
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
perl-live-mcp.pl view on Meta::CPAN
my $barrier_frame = length(encode_utf8($barrier_req)) . "\n" . encode_utf8($barrier_req);
print {$session_in} $code_frame;
print {$session_in} $barrier_frame;
my ($stdout, $stderr) = ('', '');
my $sel = IO::Select->new($session_out, $session_err);
my ($got_out, $got_err) = (0, 0);
my $deadline = time + $timeout;
my $interrupted = 0;
perl-live-mcp.pl view on Meta::CPAN
$stdout .= $buf;
if ($stdout =~ s/__B_OUT_${token}__\n//) {
$got_out = 1;
}
} else {
$stderr .= $buf;
if ($stderr =~ s/__B_ERR_${token}__\n//) {
$got_err = 1;
}
}
} elsif (defined $read && $read == 0) {
$sel->remove($fh);
perl-live-mcp.pl view on Meta::CPAN
last;
}
}
$session_eval_count++;
return (decode_utf8($stdout), decode_utf8($stderr), $interrupted);
}
my %tools = (
perl_live_eval => {
name => 'perl_live_eval',
perl-live-mcp.pl view on Meta::CPAN
my $result_text = '';
if (length $out) {
$result_text .= $out;
}
if (length $err) {
$result_text .= ($result_text ? "\n[stderr]\n" : "") . $err;
}
if (!length($out) && !length($err)) {
$result_text = "(evaluated successfully, no output)\n";
}
if ($interrupted) {
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
my $cv = AnyEvent->condvar(
cb => sub {
my ($results, $res_out, $res_err) = $_[0]->recv;
say "success or fail: " . Dumper($results);
say "script stdout: " . Dumper($res_out);
say "script stderr: " . Dumper($res_err);
$self->finish( delete => $qjob->id );
}
);
my %results = ();
my %stdout = ();
my %stderr = ();
$cv->begin( sub { $_[0]->send( \%results, \%stdout, \%stderr ) } );
run_scripts( $cv, $job->{target}, $job->{scripts}, \%results, \%stdout, \%stderr );
$cv->end;
}
);
$w->start;
my $target = shift;
my $scripts = shift;
my $results = shift;
my $stdout = shift;
my $stderr = shift;
my $ipc = AnyEvent::Open3::Simple->new(
on_start => sub {
my $proc = shift;
AE::log trace => "pid: " . $proc->pid;
my $line = shift;
AE::log trace => $proc->pid . " stdout: " . $line;
$stdout->{$proc->pid} .= $line . "\n";
},
on_stderr => sub {
my $proc = shift;
my $line = shift;
AE::log trace => $proc->pid . " stderr: " . $line;
$stderr->{$proc->pid} .= $line . "\n";
},
on_exit => sub {
my $proc = shift;
my $exval = shift;
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/superfluous_warning.t view on Meta::CPAN
my $h = Test::Database->handle('mysql') or plan skip_all => '~/.test-database not configured';
local *STDERR;
open STDERR, '>', \my $stderr or die $!;
# failed connect (because of wrong port 3307) will add undefined $dbh into {CachedKids}
AnyEvent::DBI::MySQL->connect($h->dsn.';port=3307', $h->username, $h->password,
{RaiseError=>0,PrintError=>0});
# passed connect shouldn't print warnings because of undefined $dbh in {CachedKids}
AnyEvent::DBI::MySQL->connect($h->connection_info,
{RaiseError=>0,PrintError=>0});
# work around warning in EV because ./Build test run `perl -w`
my $cleaned_stderr = join "\n", grep {!/Too late to run CHECK block/} split "\n", $stderr || q{};
is $cleaned_stderr, q{}, 'no warnings';
done_testing();
view all matches for this distribution
view release on metacpan or search on metacpan
t/02_sql_lite.t view on Meta::CPAN
use warnings;
use AnyEvent;
use AnyEvent::DBI;
use File::Temp qw(tempfile);
# we are going to watch what the sub-processes send to stderr
close STDERR;
my($tfh_err,$tfn_err) = tempfile;
close $tfh_err;
open(STDERR,">>$tfn_err");
t/02_sql_lite.t view on Meta::CPAN
# lets have an error
$cv = AnyEvent->condvar;
$dbh->exec('select bogus_column from no_such_table',sub {return $cv->send($@) unless $_[1];$cv->send(undef,$_[1])});
($error,$result) = $cv->recv();
like ($error,qr{no such table}i,'Select from non existant table results in error');
# ensure we got no stderr output
ok(-z $tfn_err,'Error does not result in output on STDERR');
# check the error behavior
$cv = AnyEvent->condvar;
$dbh->attr('PrintError',sub {return $cv->send($@) unless $_[1]; $cv->send(undef,$_[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?>
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/MCP/Client/JSONL.pm view on Meta::CPAN
Use this transport when the MCP server is a subprocess or an already
connected byte stream. It reads one JSON-RPC message per line, so stdout
on a conventional stdio transport must contain protocol messages only.
The C<command> mode here connects the child's stdin and stdout to a
socketpair; diagnostic output belongs on stderr. A stray banner or log
message on the protocol stream can break the connection.
An argument array executes the program directly; a command string runs
through a shell. Prefer the array form when no shell syntax is needed.
The process starts on the first connection, not when the client object
lib/AnyEvent/MCP/Client/JSONL.pm view on Meta::CPAN
=item command => [$program, $arg...]
=item command => $shell_command
Argument array for direct execution, or a string run through C</bin/sh -c>.
The child inherits stderr. No command runs until connecting.
Omit this option when using C<attach> instead.
=item env => { %environment }
Child environment overrides. Unspecified variables are inherited from
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AnyEvent.pm view on Meta::CPAN
certain features.
=item C<PERL_ANYEVENT_LOG>
Accepts rather complex logging specifications. For example, you could log
all C<debug> messages of some module to stderr, warnings and above to
stderr, and errors and above to syslog, with:
PERL_ANYEVENT_LOG=Some::Module=debug,+log:filter=warn,+%syslog:%syslog=error,syslog
For the rather extensive details, see L<AnyEvent::Log>.
view all matches for this distribution