]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 781672: checksetup.pl fails to check the version of the latest Apache2::SizeLimit...
authorFrédéric Buclin <LpSolit@gmail.com>
Thu, 1 Aug 2013 01:19:44 +0000 (03:19 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 1 Aug 2013 01:19:44 +0000 (03:19 +0200)
r=dkl a=sgreen

Bugzilla/Install/Requirements.pm

index b6e3f903322c6d182c7a30605653602971126add..0d02904e940300af9bc78453456dc97d2ee571ae 100644 (file)
@@ -676,8 +676,15 @@ sub have_vers {
     Bugzilla::Install::Util::set_output_encoding();
 
     # VERSION is provided by UNIVERSAL::, and can be called even if
-    # the module isn't loaded.
-    my $vnum = $module->VERSION || -1;
+    # the module isn't loaded. We eval'uate ->VERSION because it can die
+    # when the version is not valid (yes, this happens from time to time).
+    # In that case, we use an uglier method to get the version.
+    my $vnum = eval { $module->VERSION };
+    if ($@) {
+        no strict 'refs';
+        $vnum = ${"${module}::VERSION"};
+    }
+    $vnum ||= -1;
 
     # Fix CPAN versions like 1.9304.
     if ($module eq 'CPAN' and $vnum =~ /^(\d\.\d{2})\d{2}$/) {