File tree 1 file changed +8
-11
lines changed
1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ PostgresVersion - class representing PostgreSQL version numbers
34
34
35
35
=head1 DESCRIPTION
36
36
37
- PostgresVersion encapsulated Postgres version numbers, providing parsing
37
+ PostgresVersion encapsulates Postgres version numbers, providing parsing
38
38
of common version formats and comparison operations.
39
39
40
40
=cut
@@ -73,25 +73,22 @@ sub new
73
73
my $class = shift ;
74
74
my $arg = shift ;
75
75
76
+ chomp $arg ;
77
+
76
78
# Accept standard formats, in case caller has handed us the output of a
77
79
# postgres command line tool
78
- $arg = $1
79
- if ($arg =~ m /\( ?PostgreSQL\) ? (\d +(?:\.\d +)*(?:devel)?)/ );
80
+ my $devel ;
81
+ ($arg ,$devel ) = ($1 , $2 )
82
+ if ($arg =~ m / ^(?:\( ?PostgreSQL\) ? )?(\d +(?:\.\d +)*)(devel)?/ );
80
83
81
84
# Split into an array
82
85
my @result = split (/ \. / , $arg );
83
86
84
87
# Treat development versions as having a minor/micro version one less than
85
88
# the first released version of that branch.
86
- if ($result [$#result ] =~ m / ^(\d +)devel$ / )
87
- {
88
- pop (@result );
89
- push (@result , $1 , -1);
90
- }
89
+ push @result , -1 if ($devel );
91
90
92
- my $res = [@result ];
93
- bless $res , $class ;
94
- return $res ;
91
+ return bless \@result , $class ;
95
92
}
96
93
97
94
You can’t perform that action at this time.
0 commit comments