Re: Extend compatibility of PostgreSQL::Test::Cluster

From: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Extend compatibility of PostgreSQL::Test::Cluster
Date: 2021-12-31 16:20:03
Message-ID: 87lf00oifg.fsf@wibble.ilmari.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:

> + my $subclass = __PACKAGE__ . "::V_$maj";
> + bless $node, $subclass;
> + unless ($node->isa(__PACKAGE__))
> + {
> + # It's not a subclass, so re-bless back into the main package
> + bless($node, __PACKAGE__);
> + carp "PostgreSQL::Test::Cluster isn't fully compatible with version $ver";
> + }

The ->isa() method works on package names as well as blessed objects, so
the back-and-forth blessing can be avoided.

my $subclass = __PACKAGE__ . "::V_$maj";
if ($subclass->isa(__PACKAGE__))
{
bless($node, $subclass);
}
else
{
carp "PostgreSQL::Test::Cluster isn't fully compatible with version $ver";
}

- ilmari

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2021-12-31 16:22:49 Re: Extend compatibility of PostgreSQL::Test::Cluster
Previous Message Hans Buschmann 2021-12-31 15:34:55 AW: Introducing PgVA aka PostgresVectorAcceleration using SIMD vector instructions starting with hex_encode