projects
/
clawsker.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c720626
)
Compare versions with version objects
author
Ricardo Mones
<ricardo@mones.org>
Sun, 11 Dec 2016 12:47:33 +0000
(13:47 +0100)
committer
Ricardo Mones
<ricardo@mones.org>
Sun, 11 Dec 2016 12:47:33 +0000
(13:47 +0100)
clawsker
patch
|
blob
|
history
diff --git
a/clawsker
b/clawsker
index 10a9533f29d2bda96393f19c7b1cca208ee07658..78923ccf14cb0c8e139e3b994f88e62a86284072 100755
(executable)
--- a/
clawsker
+++ b/
clawsker
@@
-17,6
+17,7
@@
binmode STDOUT, ":encoding(utf8)";
use 5.010_000;
use strict;
use utf8;
use 5.010_000;
use strict;
use utf8;
+use version 0.77;
use Glib qw(TRUE FALSE);
use Gtk2;
use POSIX qw(setlocale);
use Glib qw(TRUE FALSE);
use Gtk2;
use POSIX qw(setlocale);
@@
-270,18
+271,7
@@
use constant PAGE_SPC => 5;
sub version_greater_or_equal {
my ($version, $refvers) = @_;
sub version_greater_or_equal {
my ($version, $refvers) = @_;
- my @version = split (/\./, $version);
- my @refvers = split (/\./, $refvers);
- while ($#version < $#refvers) {
- push (@version, '0');
- }
- my $idx = 0;
- while (($idx <= $#refvers)
- and (int ($version[$idx]) == int ($refvers[$idx]))) {
- ++$idx;
- }
- return TRUE if (($idx > $#refvers)
- or (int ($version[$idx]) >= int ($refvers[$idx])));
+ return TRUE if (version->parse($version) >= version->parse($refvers));
return FALSE;
}
return FALSE;
}