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
view release on metacpan or search on metacpan
mod_aimproxy.c view on Meta::CPAN
n = c -> pass -> nelts ;
for (i = 0; i < n; i++)
{
if (strncmp (uri, ent[i].proxysrc, ent[i].proxysrclen) == 0)
{
/*fprintf(stderr, "found %s -> %s\n" , ent[i].proxysrc, ent[i].proxyhost) ;*/
found = 1 ;
break ;
}
}
if (!found)
{
/*fprintf(stderr, "aimproxy not found %s\n" , uri) ;*/
return DECLINED ; /* is not our request */
}
proxyhost = ent[i].proxyhost ;
args = r -> args ;
path_info = r -> path_info ;
/* If the file exists and there are no transformation arguments
just decline the transaction. It will be handled as usual. */
/*fprintf(stderr, "uri %s args %s path_info %s\n" , uri, args, path_info) ;*/
/*fprintf(stderr, "r -> finfo.st_mode %d\n" , r -> finfo.st_mode) ;*/
if ((!args || !*args) && (!path_info || !*path_info) && r -> finfo.st_mode)
return DECLINED ;
/* calculate name of cache file */
file = r->filename;
mod_aimproxy.c view on Meta::CPAN
if (ext)
ext++ ;
else
ext = "" ;
cachefn = ap_pstrcat (r -> pool, md5, ".", ext, NULL) ;
/*fprintf(stderr, "cachefn = %s\n" , cachefn) ;*/
cachedir = c -> cachedir ;
cachepath = ap_pstrcat (r -> pool, cachedir, "/", cachefn, NULL) ;
/*fprintf(stderr, "cachepath = %s\n" , cachepath) ;*/
if (stat (cachepath, &finfo) == 0)
{ /* let apache do the rest if image already exists */
r -> filename = cachepath ;
r -> path_info = "" ;
memcpy (&r -> finfo, &finfo, sizeof (r -> finfo)) ;
mod_aimproxy.c view on Meta::CPAN
r->filename = ap_pstrcat(r->pool, "proxy:http://", proxyhost, r-> uri, NULL);
r->handler = "proxy-server";
r->proxyreq = PROXY_PASS;
/*fprintf(stderr, "proxy to = %s\n" , r->filename) ;*/
return OK;
}
view all matches for this distribution
view release on metacpan or search on metacpan
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|
warner_nocontext|||vn
warner||5.006000|v
warn|||v
watch|||
whichsig|||
write_to_stderr|||
yyerror|||
yylex|||
yyparse|||
yywarn|||
);
view all matches for this distribution
view release on metacpan or search on metacpan
* from %INC so the log is re-opened
*/
static void inc_delete(void *data)
{
SV *file = (SV*)data;
/*fprintf(stderr, "removing %s from INC\n", SvPV(file,na));*/
(void)hv_delete_ent(GvHV(incgv), file, G_DISCARD, FALSE);
SvREFCNT_dec(file);
}
static void mark_for_inc_delete(SV *file)
RETVAL->log_fd = piped_log_write_fd(pl);
}
else {
char *fname = server_root_relative(p, RETVAL->fname);
if ((RETVAL->log_fd = popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
fprintf(stderr, "Apache::LogFile: could not open log file %s.\n",
fname);
exit(1);
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
static void
dump_Mmap( m )
Mmap *m;
{
if( m != NULL )
fprintf( stderr,
"Apache::Mmap %x:\naddr: %x\tlen: %d\tcur: %d\noff: %d\tprot: %d\tflags: %d\n",
m, m->addr, m->len, m->cur, m->off, m->prot, m->flags );
}
static int
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Perldoc.pm view on Meta::CPAN
} else {
$perldoc ||= "perldoc";
$pod2html ||= "pod2html";
}
# Get the path name and throw away errors on stderr
my $filename = qx( $perldoc -l $pod 2> /dev/null );
if ($?) {
print
"No such perldoc. Either you don't have that module installed, or the author neglected to provide documentation.";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Pod/HTML.pm view on Meta::CPAN
my $file = Apache::Pod::getpodfile( $r );
if ( $file ) {
my $parser = Pod::Simple::HTML->new;
$parser->no_errata_section(1);
$parser->complain_stderr(1);
$parser->output_string( \$body );
$parser->index( $r->dir_config('INDEX') );
if ( my $prefix = $r->dir_config('LINKBASE') ) {
if ( $prefix eq 'LOCAL' ) {
$prefix = $r->location . '/';
view all matches for this distribution
view release on metacpan or search on metacpan
Scoreboard.xs view on Meta::CPAN
"running under mod_perl");
#endif
}
#ifdef DUMMY_SCOREBOARD
#define MY_WARN fprintf(stderr,
#else
#define MY_WARN ap_log_error(APLOG_MARK, APLOG_ERR, 0, modperl_global_get_server_rec(),
#endif
#if 0
Scoreboard.xs view on Meta::CPAN
psize = sizeof(process_score) * image->server_limit;
msize = sizeof(worker_score) * image->thread_limit;
ssize = msize * image->server_limit;
tsize = psize + ssize + sizeof(global_score) + sizeof(buf);
/* fprintf(stderr, "sizes %d, %d, %d, %d, %d\n",
psize, ssize, sizeof(global_score) , sizeof(buf), tsize); */
pack16(ptr, psize);
ptr += SIZE16;
pack16(ptr, ssize);
Scoreboard.xs view on Meta::CPAN
sb = image->sb;
for (i = 0; i < image->server_limit; i++) {
if (!(sb->parent[i].pid)) {
break;
}
/* fprintf(stderr, "pids: server %d: pid %d\n",
i, (int)(sb->parent[i].pid)); */
av_push(av, newSViv(sb->parent[i].pid));
}
RETVAL = newRV_noinc((SV*)av);
Scoreboard.xs view on Meta::CPAN
CODE:
sb = image->sb;
for (i = 0; i < image->thread_limit; ++i) {
/* fprintf(stderr, "thread_num: server %d, thread %d pid %d\n",
i, sb->servers[parent_idx][i].thread_num,
(int)(sb->parent[parent_idx].pid)); */
av_push(av, newSViv(sb->servers[parent_idx][i].thread_num));
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
# setup some convience variables so we have to type less
$s->{uof} = "$s->{ubase}/$s->{object}/$s->{function}";
$s->{uo} = "$s->{ubase}/$s->{object}";
if ($s->{o}{log_stderr}) {
my $dd = Data::Dumper->new([\%{$s->{in}}],[qw(data)]);
$dd->Indent(0);
$s->db_insert('object_debug',{
o => $s->{object},
f => $s->{function},
view all matches for this distribution
view release on metacpan or search on metacpan
SubProcess.xs view on Meta::CPAN
PUSHMARK(sp);
XPUSHs(perl_bless_request_rec(info->r));
PUTBACK;
count = perl_call_sv(info->cv, G_EVAL | G_SCALAR);
if(perl_eval_ok(info->r->server) != OK) {
fprintf(stderr, "FAIL: %s\n", SvPV(ERRSV,na));
}
/*
SPAGAIN;
PUTBACK;
SubProcess.xs view on Meta::CPAN
PREINIT:
char **env;
CODE:
env = ap_create_environment(r->pool, r->subprocess_env);
ap_error_log2stderr(r->server);
ap_cleanup_for_exec();
RETVAL = ap_call_exec(r, (child_info *)r->request_config, pgm, env, 0);
ap_log_error(APLOG_MARK, APLOG_ERR, NULL,
"Apache::SubProcess exec of %s failed", pgm);
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
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
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|
warner|5.006000|5.004000|pv
warn|||v
watch|||
whichsig|||
write_no_mem|||
write_to_stderr|||
xmldump_all|||
xmldump_attr|||
xmldump_eval|||
xmldump_form|||
xmldump_indent|||v
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-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
t/01-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
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|
warner|5.006000|5.004000|pv
warn|||v
watch|||
whichsig|||
write_no_mem|||
write_to_stderr|||
xmldump_all|||
xmldump_attr|||
xmldump_eval|||
xmldump_form|||
xmldump_indent|||v
view all matches for this distribution
view release on metacpan or search on metacpan
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|
warner|5.006000|5.004000|pv
warn|||v
watch|||
whichsig|||
write_no_mem|||
write_to_stderr|||
xmldump_all|||
xmldump_attr|||
xmldump_eval|||
xmldump_form|||
xmldump_indent|||v
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/Pod/HTML.pm view on Meta::CPAN
my $body;
my $file = Apache2::Pod::getpodfile( $r );
my $fun = undef;
my $parser = Apache2::Pod::PodSimpleHTML->new;
$parser->no_errata_section(1);
$parser->complain_stderr(1);
$parser->output_string( \$body );
$parser->index( $r->dir_config('INDEX') );
if ( my $prefix = $r->dir_config('LINKBASE') ) {
if ( $prefix eq 'LOCAL' ) {
$prefix = $r->location . '/';
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/PodBrowser.pm view on Meta::CPAN
$parser->html_css(_stylesheet($r)) if ($parser->can('html_css'));
$parser->html_header_after_title($parser->html_header_after_title.
_indexlink(INDEX_NORMAL)."\n")
if ($uplink and $parser->can('html_header_after_title'));
$parser->no_errata_section(1);
$parser->complain_stderr(1);
$parser->output_string( \$body );
$parser->index( $r->dir_config('INDEX') ) if ($parser->can('index'));
if ($parser->can('perldoc_url_prefix')) {
my $prefix=$r->dir_config('LINKBASE');
if (defined $prefix) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/SSI/File/Type.pm view on Meta::CPAN
return( $type );
}
sub default_type { return( shift->_set_get_scalar( 'default_type', @_ ) ); }
# Recursively write the magic file to stderr.
# Numbers are written in decimal.
sub dump
{
my $self = shift( @_ );
my $data = shift( @_ ) || $self->{magic_data};
view all matches for this distribution
view release on metacpan or search on metacpan
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|
warner|5.006000|5.004000|pv
warn|||v
watch|||
whichsig|||
write_no_mem|||
write_to_stderr|||
xmldump_all|||
xmldump_attr|||
xmldump_eval|||
xmldump_form|||
xmldump_indent|||v
view all matches for this distribution
view release on metacpan or search on metacpan
bin/cron.loghack view on Meta::CPAN
my $self = bless(\%o, __PACKAGE__);
local $SIG{__DIE__} = $self->quiet ? sub {
die @_ if $^S; # get out if we're in an eval
$self->stderr(@_);
$self->death(@_);
} : $SIG{__DIE__};
my @got = $self->do_fetch(@only ? @only : $self->servers);
my @links = $self->do_links(@got);
bin/cron.loghack view on Meta::CPAN
my (@command) = @_;
$self->stdout('running', " @command");
my ($ret, $out, $err) = $self->_run(@command);
$self->stdout(split(/\n/, $out));
$self->stderr(split(/\n/, $err));
$ret or die "@command failed:\n$err";
return($out);
}
sub capture {
bin/cron.loghack view on Meta::CPAN
sub death {
my $self = shift;
my (@last) = @_;
my %sym = (stderr => 'E ', stdout => '# ');
print "DEATH\n @last\n";
my $out = $self->{outputs} ||= [];
foreach my $line (@$out) {
my $type = shift(@$line);
my $c = $sym{$type} || $type; # hmm
print join(' ', $c, @$line), "\n";
}
}
my %fh = (
stderr => \*STDERR,
stdout => \*STDOUT,
);
sub stderr {
my $self = shift;
$self->_store_io(stderr => @_);
}
sub stdout {
my $self = shift;
$self->_store_io(stdout => @_);
}
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");
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
and not eval { require blib; blib->VERSION('1.01') };
view all matches for this distribution