Skip to content

Commit fa26eba

Browse files
committed
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.
1 parent 0c8f408 commit fa26eba

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/test/perl/PostgresVersion.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,12 @@ sub new
110110
#
111111
sub _version_cmp
112112
{
113-
my ($a, $b) = @_;
113+
my ($a, $b, $swapped) = @_;
114114

115115
$b = __PACKAGE__->new($b) unless blessed($b);
116116

117+
($a, $b) = ($b, $a) if $swapped;
118+
117119
my ($an, $bn) = ($a->{num}, $b->{num});
118120

119121
for (my $idx = 0;; $idx++)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy