Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7d9a430

Browse files
committed
perltidy PostgresNode and SimpleTee
Also, mention in README that Perl files should be perltidy'ed. Thisisn't really the best place (since we have Perl files elsewhere in thetree) and this is already in pgindent's README, but this subdir islikely to get hacked a whole lot more than the other Perl files, so itseems okay to spend two lines on this.Author: Craig Ringer
1 parent5bec1ad commit7d9a430

File tree

3 files changed

+41
-33
lines changed

3 files changed

+41
-33
lines changed

‎src/test/perl/PostgresNode.pm

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
=pod
23
34
=head1NAME
@@ -106,18 +107,15 @@ of finding port numbers, registering instances for cleanup, etc.
106107

107108
subnew
108109
{
109-
my$class =shift;
110-
my$name =shift;
111-
my$pghost =shift;
112-
my$pgport =shift;
110+
my ($class,$name,$pghost,$pgport) =@_;
113111
my$testname = basename($0);
114112
$testname =~s/\.[^.]+$//;
115-
my$self= {
116-
_port=>$pgport,
117-
_host=>$pghost,
118-
_basedir=> TestLib::tempdir("data_" .$name),
119-
_name=>$name,
120-
_logfile=>"$TestLib::log_path/${testname}_${name}.log" };
113+
my$self = {
114+
_port=>$pgport,
115+
_host=>$pghost,
116+
_basedir=> TestLib::tempdir("data_" .$name),
117+
_name=>$name,
118+
_logfile=>"$TestLib::log_path/${testname}_${name}.log" };
121119

122120
bless$self,$class;
123121
$self->dump_info;
@@ -367,7 +365,7 @@ sub init
367365
$params{hba_permit_replication} = 1
368366
unlessdefined$params{hba_permit_replication};
369367
$params{allows_streaming} = 0unlessdefined$params{allows_streaming};
370-
$params{has_archiving} = 0unlessdefined$params{has_archiving};
368+
$params{has_archiving}= 0unlessdefined$params{has_archiving};
371369

372370
mkdir$self->backup_dir;
373371
mkdir$self->archive_dir;
@@ -405,7 +403,7 @@ sub init
405403
close$conf;
406404

407405
$self->set_replication_confif$params{hba_permit_replication};
408-
$self->enable_archivingif$params{has_archiving};
406+
$self->enable_archivingif$params{has_archiving};
409407
}
410408

411409
=pod
@@ -492,7 +490,7 @@ sub init_from_backup
492490

493491
$params{has_streaming} = 0unlessdefined$params{has_streaming};
494492
$params{hba_permit_replication} = 1
495-
unlessdefined$params{hba_permit_replication};
493+
unlessdefined$params{hba_permit_replication};
496494
$params{has_restoring} = 0unlessdefined$params{has_restoring};
497495

498496
print
@@ -514,7 +512,7 @@ sub init_from_backup
514512
qq(
515513
port =$port
516514
));
517-
$self->set_replication_confif$params{hba_permit_replication};
515+
$self->set_replication_confif$params{hba_permit_replication};
518516
$self->enable_streaming($root_node)if$params{has_streaming};
519517
$self->enable_restoring($root_node)if$params{has_restoring};
520518
}
@@ -607,19 +605,19 @@ sub promote
607605
my$logfile =$self->logfile;
608606
my$name =$self->name;
609607
print"### Promoting node\"$name\"\n";
610-
TestLib::system_log('pg_ctl','-D',$pgdata,'-l',$logfile,
611-
'promote');
608+
TestLib::system_log('pg_ctl','-D',$pgdata,'-l',$logfile,'promote');
612609
}
613610

614611
# Internal routine to enable streaming replication on a standby node.
615612
subenable_streaming
616613
{
617-
my ($self,$root_node)=@_;
614+
my ($self,$root_node) =@_;
618615
my$root_connstr =$root_node->connstr;
619-
my$name =$self->name;
616+
my$name=$self->name;
620617

621618
print"### Enabling streaming replication for node\"$name\"\n";
622-
$self->append_conf('recovery.conf',qq(
619+
$self->append_conf(
620+
'recovery.conf',qq(
623621
primary_conninfo='$root_connstr application_name=$name'
624622
standby_mode=on
625623
));
@@ -628,7 +626,7 @@ standby_mode=on
628626
# Internal routine to enable archive recovery command on a standby node
629627
subenable_restoring
630628
{
631-
my ($self,$root_node)=@_;
629+
my ($self,$root_node) =@_;
632630
my$path =$root_node->archive_dir;
633631
my$name =$self->name;
634632

@@ -641,11 +639,13 @@ sub enable_restoring
641639
# first. Paths also need to be double-quoted to prevent failures where
642640
# the path contains spaces.
643641
$path =~s{\\}{\\\\}gif ($TestLib::windows_os);
644-
my$copy_command =$TestLib::windows_os ?
645-
qq{copy "$path\\\\%f" "%p"} :
646-
qq{cp$path/%f%p};
642+
my$copy_command =
643+
$TestLib::windows_os
644+
?qq{copy "$path\\\\%f" "%p"}
645+
:qq{cp$path/%f%p};
647646

648-
$self->append_conf('recovery.conf',qq(
647+
$self->append_conf(
648+
'recovery.conf',qq(
649649
restore_command = '$copy_command'
650650
standby_mode = on
651651
));
@@ -667,12 +667,14 @@ sub enable_archiving
667667
# first. Paths also need to be double-quoted to prevent failures where
668668
# the path contains spaces.
669669
$path =~s{\\}{\\\\}gif ($TestLib::windows_os);
670-
my$copy_command =$TestLib::windows_os ?
671-
qq{copy "%p" "$path\\\\%f"} :
672-
qq{cp%p$path/%f};
670+
my$copy_command =
671+
$TestLib::windows_os
672+
?qq{copy "%p" "$path\\\\%f"}
673+
:qq{cp%p$path/%f};
673674

674675
# Enable archive_mode and archive_command on node
675-
$self->append_conf('postgresql.conf',qq(
676+
$self->append_conf(
677+
'postgresql.conf',qq(
676678
archive_mode = on
677679
archive_command = '$copy_command'
678680
));

‎src/test/perl/README

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ isolation tester specs in src/test/isolation, if possible. If not, check to
1111
see if your new tests make sense under an existing tree in src/test, like
1212
src/test/ssl, or should be added to one of the suites for an existing utility.
1313

14+
Note that all tests and test tools should have perltidy run on them before
15+
patches are submitted, using perltidy --profile=src/tools/pgindent/perltidyrc
16+
1417
Writing tests
1518
-------------
1619

‎src/test/perl/SimpleTee.pm

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@
1010
packageSimpleTee;
1111
use strict;
1212

13-
subTIEHANDLE {
13+
subTIEHANDLE
14+
{
1415
my$self =shift;
1516
bless \@_,$self;
1617
}
1718

18-
subPRINT {
19+
subPRINT
20+
{
1921
my$self =shift;
20-
my$ok = 1;
21-
formy$fh (@$self) {
22+
my$ok = 1;
23+
formy$fh (@$self)
24+
{
2225
print$fh@_or$ok = 0;
23-
$fh->flushor$ok = 0;
26+
$fh->flushor$ok = 0;
2427
}
2528
return$ok;
2629
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp