Re: Making background psql nicer to use in tap tests - Mailing list pgsql-hackers

From Dagfinn Ilmari Mannsåker
Subject Re: Making background psql nicer to use in tap tests
Date
Msg-id 87v8izs13n.fsf@wibble.ilmari.org
Whole thread Raw
In response to Re: Making background psql nicer to use in tap tests  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Making background psql nicer to use in tap tests  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
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};
    }

- ilmari



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: ICU locale validation / canonicalization
Next
From: Jeff Davis
Date:
Subject: Re: ICU 54 and earlier are too dangerous