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

Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>

From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-12-31T16:20:03Z
Lists: pgsql-hackers
Andrew Dunstan <andrew@dunslane.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



Commits

  1. Make PostgreSQL::Test::Cluster compatible with all live branches