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
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
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
# No cache - should return 0
%Apache::Session::Browseable::Store::Patroni::patroniCache = ();
my $args = { DataSource => $ds, PatroniCacheTTL => 60 };
# Capture STDERR
my $stderr = '';
{
local *STDERR;
open STDERR, '>', \$stderr;
my $result = $store->_useCachedLeader( $args, $ds, "Test reason" );
is( $result, 0, '_useCachedLeader: returns 0 when no cache' );
}
# With valid cache
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
port => 5432,
time => time() - 10 # 10 seconds ago
}
};
$stderr = '';
{
local *STDERR;
open STDERR, '>', \$stderr;
my $result = $store->_useCachedLeader( $args, $ds, "Test reason" );
is( $result, 1, '_useCachedLeader: returns 1 when cache valid' );
}
like( $args->{DataSource}, qr/host=10\.0\.0\.5/,
'_useCachedLeader: updates DataSource with cached host' );
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
time => time() - 120 # 2 minutes ago, expired
}
};
$args = { DataSource => $ds, PatroniCacheTTL => 60 };
$stderr = '';
{
local *STDERR;
open STDERR, '>', \$stderr;
my $result = $store->_useCachedLeader( $args, $ds, "Test reason" );
is( $result, 0, '_useCachedLeader: returns 0 when cache expired' );
}
# Clear cache
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
PatroniCacheTTL => 60,
};
# Circuit breaker should be active (failed 10s ago, delay is 30s)
# It should use cached leader instead of calling API
my $stderr = '';
{
local *STDERR;
open STDERR, '>', \$stderr;
my $result = $store->checkMaster($args);
is( $result, 1, 'Circuit breaker: uses cached leader when active' );
}
like(
$stderr,
qr/Circuit breaker active/,
'Circuit breaker: prints appropriate message'
);
like( $args->{DataSource}, qr/host=10\.0\.0\.7/,
'Circuit breaker: uses cached host' );
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
PatroniCacheTTL => 120,
};
# Circuit breaker should NOT be active (failed 60s ago, delay is 30s)
# It will try to call API (which will fail) then use cache
my $stderr = '';
{
local *STDERR;
open STDERR, '>', \$stderr;
# This will try HTTP (fail) then fallback to cache
my $result = $store->checkMaster($args);
is( $result, 1,
'Circuit breaker expired: uses cache after API failure' );
}
like(
$stderr,
qr/Patroni API unavailable/,
'Circuit breaker expired: API was tried'
);
# Clear cache
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
PatroniUrl => 'http://fake:8008/cluster',
};
# Without cache, checkMaster will try HTTP and fail
# This tests that defaults are applied correctly
my $stderr = '';
{
local *STDERR;
open STDERR, '>', \$stderr;
# Store the time before calling checkMaster
my $before = time();
my $result = $store->checkMaster($args);
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
my $store = $package->new;
$store->{_originalDataSource} = $ds;
# With 30s TTL, cache should be expired
my $args1 = { DataSource => $ds, PatroniCacheTTL => 30 };
my $stderr = '';
{
local *STDERR;
open STDERR, '>', \$stderr;
my $result = $store->_useCachedLeader( $args1, $ds, "Test" );
is( $result, 0, 'Custom TTL 30s: cache expired at 45s' );
}
# With 60s TTL, cache should be valid
my $args2 = { DataSource => $ds, PatroniCacheTTL => 60 };
$stderr = '';
{
local *STDERR;
open STDERR, '>', \$stderr;
my $result = $store->_useCachedLeader( $args2, $ds, "Test" );
is( $result, 1, 'Custom TTL 60s: cache valid at 45s' );
}
# Clear cache
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
my $args = {
DataSource => $ds,
PatroniUrl => 'http://mock:8008/cluster'
};
my $stderr = '';
my $result;
{
local *STDERR;
open STDERR, '>', \$stderr;
$result = $store->checkMaster($args);
}
is( $result, 1, 'Valid leader: checkMaster returns 1' );
like( $args->{DataSource}, qr/host=10\.0\.0\.100/,
'Valid leader: correct host in DataSource' );
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
my $args = {
DataSource => $ds,
PatroniUrl => 'http://mock:8008/cluster'
};
my $stderr = '';
my $result;
{
local *STDERR;
open STDERR, '>', \$stderr;
$result = $store->checkMaster($args);
}
is( $result, 0, 'Split-brain: checkMaster returns 0' );
like(
$stderr,
qr/Multiple leaders detected/,
'Split-brain: warning message'
);
}
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
my $args = {
DataSource => $ds,
PatroniUrl => 'http://mock:8008/cluster'
};
my $stderr = '';
my $result;
{
local *STDERR;
open STDERR, '>', \$stderr;
$result = $store->checkMaster($args);
}
is( $result, 0, 'Leader starting: checkMaster returns 0' );
like(
$stderr,
qr/not in running state/,
'Leader starting: warning message'
);
}
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
my $args = {
DataSource => $ds,
PatroniUrl => 'http://mock:8008/cluster'
};
my $stderr = '';
my $result;
{
local *STDERR;
open STDERR, '>', \$stderr;
$result = $store->checkMaster($args);
}
is( $result, 0, 'Leader missing host: checkMaster returns 0' );
like(
$stderr,
qr/missing host or port/,
'Leader missing host: warning message'
);
}
t/Apache-Session-Browseable-Store-Patroni.t view on Meta::CPAN
my $args = {
DataSource => $ds,
PatroniUrl => 'http://mock:8008/cluster'
};
my $stderr = '';
my $result;
{
local *STDERR;
open STDERR, '>', \$stderr;
$result = $store->checkMaster($args);
}
is( $result, 0, 'No leader: checkMaster returns 0' );
like( $stderr, qr/No leader found/, 'No leader: warning message' );
}
# Clear cache
%Apache::Session::Browseable::Store::Patroni::patroniCache = ();
}
view all matches for this distribution