Content-Length: 267682 | pFad | http://github.com/postgrespro/postgres/commit/fa26eba221a9e837493df47d0255ce615129e9a8

06 Improve logic in PostgresVersion.pm · postgrespro/postgres@fa26eba · GitHub
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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/fa26eba221a9e837493df47d0255ce615129e9a8

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy