Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.15.198.120
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2/cwd/proc/3/cwd/lib/postgresql/15/lib/pgxs/src/test/perl/PostgreSQL/Test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/2/cwd/proc/3/cwd/lib/postgresql/15/lib/pgxs/src/test/perl/PostgreSQL/Test/SimpleTee.pm
# Copyright (c) 2021-2022, PostgreSQL Global Development Group

# A simple 'tee' implementation, using perl tie.
#
# Whenever you print to the handle, it gets forwarded to a list of
# handles. The list of output filehandles is passed to the constructor.
#
# This is similar to IO::Tee, but only used for output. Only the PRINT
# method is currently implemented; that's all we need. We don't want to
# depend on IO::Tee just for this.

# The package is enhanced to add timestamp and elapsed time decorations to
# the log file traces sent through this interface from Test::More functions
# (ok, is, note, diag etc.). Elapsed time is shown as the time since the last
# log trace.

package PostgreSQL::Test::SimpleTee;
use strict;
use warnings;

use Time::HiRes qw(time);

my $last_time;

BEGIN { $last_time = time; }

sub _time_str
{
	my $tm   = time;
	my $diff = $tm - $last_time;
	$last_time = $tm;
	my ($sec, $min, $hour) = localtime($tm);
	my $msec = int(1000 * ($tm - int($tm)));
	return sprintf("[%.2d:%.2d:%.2d.%.3d](%.3fs) ",
		$hour, $min, $sec, $msec, $diff);
}

sub TIEHANDLE
{
	my $self = shift;
	return bless \@_, $self;
}

sub PRINT
{
	my $self = shift;
	my $ok   = 1;
	# The first file argument passed to tiehandle in PostgreSQL::Test::Utils is
	# the original stdout, which is what PROVE sees. Additional decorations
	# confuse it, so only put out the time string on files after the first.
	my $skip = 1;
	my $ts   = _time_str;
	for my $fh (@$self)
	{
		print $fh ($skip ? "" : $ts), @_ or $ok = 0;
		$fh->flush or $ok = 0;
		$skip = 0;
	}
	return $ok;
}

1;

Anon7 - 2022
AnonSec Team