[Rt-commit] rt branch, 4.2/handle-alphabet-in-plugin-version, created. rt-4.2.15beta1-2-geca6857f5

? sunnavy sunnavy at bestpractical.com
Wed May 23 12:07:18 EDT 2018


The branch, 4.2/handle-alphabet-in-plugin-version has been created
        at  eca6857f5ebeba0fb9205810cd3ec7e75fdb6152 (commit)

- Log -----------------------------------------------------------------
commit eca6857f5ebeba0fb9205810cd3ec7e75fdb6152
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue May 22 01:37:59 2018 +0800

    Handle alphabetic words in RT::Plugin::Version
    
    Perl's VERSION method doesn't support alphabetic words like "0.3beta",
    and it dies with message:
    
        Invalid version format (non-numeric data)
    
    Thus, to support versions like "0.3beta" for RT plugins and render them
    correctly on system configuration page, we can't use the VERSION method,
    instead, we can use plugins' $VERSION variables directly.

diff --git a/lib/RT/Plugin.pm b/lib/RT/Plugin.pm
index d73029fdf..ef3ee9572 100644
--- a/lib/RT/Plugin.pm
+++ b/lib/RT/Plugin.pm
@@ -92,7 +92,8 @@ Returns the extension version.
 
 sub Version {
     my $self = shift;
-    return $self->Name->VERSION;
+    no strict 'refs';
+    return ${$self->Name . '::VERSION'};
 }
 
 =head2 Path

-----------------------------------------------------------------------


More information about the rt-commit mailing list