mirror of
https://github.com/postgres/postgres.git
synced 2026-03-28 13:23:48 -04:00
This complies with the perlcritic policy Subroutines::RequireFinalReturn, which is a severity 4 policy. Since we only currently check at severity level 5, the policy is raised to that level until we move to level 4 or lower, so that any new infringements will be caught. A small cosmetic piece of tidying of the pgperlcritic script is included. Mike Blackwell Discussion: https://postgr.es/m/CAESHdJpfFm_9wQnQ3koY3c91FoRQsO-fh02za9R3OEMndOn84A@mail.gmail.com
31 lines
613 B
Perl
31 lines
613 B
Perl
# 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.
|
|
|
|
package SimpleTee;
|
|
use strict;
|
|
|
|
sub TIEHANDLE
|
|
{
|
|
my $self = shift;
|
|
return bless \@_, $self;
|
|
}
|
|
|
|
sub PRINT
|
|
{
|
|
my $self = shift;
|
|
my $ok = 1;
|
|
for my $fh (@$self)
|
|
{
|
|
print $fh @_ or $ok = 0;
|
|
$fh->flush or $ok = 0;
|
|
}
|
|
return $ok;
|
|
}
|
|
|
|
1;
|