The following commit has been merged in the master branch:
commit f41bb0f6d97cb0d00c627e79d42128ccd661c625
Author: Frank Lichtenheld <[email protected]>
Date:   Sun Mar 15 18:49:15 2009 +0100

    Deb::Versions: Really only use AptPkg if available

diff --git a/lib/Deb/Versions.pm b/lib/Deb/Versions.pm
index 35f0cb5..774c9b5 100644
--- a/lib/Deb/Versions.pm
+++ b/lib/Deb/Versions.pm
@@ -70,22 +70,6 @@ our @EXPORT = qw( version_cmp version_sort suites_cmp 
suites_sort );
 
 our $VERSION = v1.0.0;
 
-BEGIN {
-    eval {
-       use AptPkg::Config '$_config';
-       use AptPkg::System '$_system';
-       use AptPkg::Version;
-
-       $_config->init;
-       $_system = $_config->system;
-       my $apt_ver = $_system->versioning;
-       *version_cmp = sub { return $apt_ver->compare(@_) };
-    };
-    unless( *version_cmp ){
-       *version_cmp = \&version_cmp_pp;
-    }
-}
-
 my $re = qr/^(?:(\d+):)?([\w.+:~-]+?)(?:-([\w+.~]+))?$/;
 sub version_cmp_pp {
     return 0 if $_[0] eq $_[1];
@@ -119,6 +103,18 @@ sub version_cmp_pp {
     return $res;
 }
 
+*version_cmp = \&version_cmp_pp;
+eval {
+    require AptPkg::Config;
+    require AptPkg::System;
+    require AptPkg::Version;
+    
+    $AptPkg::Config::_config->init;
+    $AptPkg::System::_system = $AptPkg::Config::_config->system;
+    my $apt_ver = $AptPkg::System::_system->versioning;
+    *version_cmp = sub { return $apt_ver->compare(@_) };
+};
+
 sub version_sort {
     return sort { version_cmp( $b, $a ) } @_;
 }

-- 
APT Archive Web-Frontend (Alioth repository)


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to