diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2021-04-27 08:21:15 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2021-04-27 08:21:15 -0400 |
commit | fa26eba221a9e837493df47d0255ce615129e9a8 (patch) | |
tree | 57a30699844e8d92ce9eb4ca3eb4c2c7f6a07346 /src | |
parent | 0c8f40863acb94963df9fd6a4369eb71efe9a93b (diff) | |
download | postgresql-fa26eba221a9e837493df47d0255ce615129e9a8.tar.gz postgresql-fa26eba221a9e837493df47d0255ce615129e9a8.zip |
Improve logic in PostgresVersion.pm
Handle the situation where perl swaps the order of operands of
the comparison operator. See `perldoc overload` for details:
The third argument is set to TRUE if (and only if) the two
operands have been swapped. Perl may do this to ensure that the
first argument ($self) is an object implementing the overloaded
operation, in line with general object calling conventions.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/perl/PostgresVersion.pm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/perl/PostgresVersion.pm b/src/test/perl/PostgresVersion.pm index 7ce9e62b798..55984ec7e81 100644 --- a/src/test/perl/PostgresVersion.pm +++ b/src/test/perl/PostgresVersion.pm @@ -110,10 +110,12 @@ sub new # sub _version_cmp { - my ($a, $b) = @_; + my ($a, $b, $swapped) = @_; $b = __PACKAGE__->new($b) unless blessed($b); + ($a, $b) = ($b, $a) if $swapped; + my ($an, $bn) = ($a->{num}, $b->{num}); for (my $idx = 0;; $idx++) |