Re: Making background psql nicer to use in tap tests
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: Daniel Gustafsson <daniel@yesql.se>, Andres Freund <andres@anarazel.de>,
Tom Lane <tgl@sss.pgh.pa.us>,
PostgreSQL Hackers <pgsql-hackers@postgresql.org>,
Melanie Plageman <melanieplageman@gmail.com>
Date: 2023-03-17T22:12:58Z
Lists: pgsql-hackers
On 2023-03-17 Fr 14:07, Dagfinn Ilmari Mannsåker wrote:
> Andrew Dunstan<andrew@dunslane.net> writes:
>
>> On 2023-03-17 Fr 10:08, Daniel Gustafsson wrote:
>>>> Why is $restart_before_query a package/class level value instead of
>>>> an instance value? And why can we only ever set it to 1 but not back
>>>> again? Maybe we don't want to, but it looks odd.
>>> It was mostly a POC to show what I meant with the functionality. I think there
>>> should be a way to turn it off (set it to zero) even though I doubt it will be
>>> used much.
>>
>> A common idiom is to have a composite getter/setter method for object
>> properties something like this
>>
>>
>> sub settingname
>> {
>> my ($self, $arg) = @_;
>> $self->{settingname} = $arg if defined $arg;
>> return $self->{settingname};
>> }
> Or, if undef is a valid value:
>
>
> sub settingname
> {
> my $self = shift;
> $self->[settingname} = shift if @_;
> return $self->{settingname};
> }
>
Yes, I agree that's better (modulo the bracket typo)
cheers
andrew
--
Andrew Dunstan
EDB:https://www.enterprisedb.com
Commits
-
Fix missing installation/uninstallation rules for BackgroundPsql.pm
- 241ef53b6a95 12.20 landed
- 0d80e59a1b2c 13.16 landed
- 1185be355462 14.13 landed
- 9d7506a2f7cb 15.8 landed
-
Backport BackgroundPsql perl test module
- 4b467a6581af 12.20 landed
- 12f327b210b3 13.16 landed
- 31877cd8ec8c 14.13 landed
- d5fd7865f068 15.8 landed
- 187b8991f70f 16.4 landed
-
Add missing uninstallation rule for BackgroundPsql.pm
- 7039c7cff673 16.0 cited
-
Fix missing installation rules for BackgroundPsql.pm
- a4c17c86176c 16.0 cited
-
Skip \password TAP test on old IPC::Run versions
- 2e57ffe12f6b 16.0 landed
-
Test SCRAM iteration changes with psql \password
- bf5a894c5571 16.0 landed
-
Refactor background psql TAP functions
- 664d757531e1 16.0 landed