[Rt-commit] rt branch, 4.0/config-set-ref, created. rt-4.0.6-254-g3cb2f29

? sunnavy sunnavy at bestpractical.com
Wed Aug 15 11:40:54 EDT 2012


The branch, 4.0/config-set-ref has been created
        at  3cb2f29f7239b4abac5798a7a458655f13af7efb (commit)

- Log -----------------------------------------------------------------
commit 3cb2f29f7239b4abac5798a7a458655f13af7efb
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Aug 15 22:54:40 2012 +0800

    handle ref values right when they are set multiple times in config files
    
    before this, a variable could be set to a reference successfully only once.
    now it could be set arbitrary times as other variables.
    
    see also #16951

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index ba338bb..f29f45d 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1219,13 +1219,19 @@ sub SetFromConfig {
             # Otherwie 5.10 goes boom. maybe we should skip any
             # reference
             next if ref($entry) eq 'SCALAR' || ref($entry) eq 'REF';
-            my $entry_ref = *{$entry}{ ref($ref) };
+
+            my $ref_type = ref($ref);
+
+            # regex/arrayref/hashref/coderef are stored in SCALAR glob
+            $ref_type = 'SCALAR' if $ref_type eq 'REF';
+
+            my $entry_ref = *{$entry}{ $ref_type };
             next unless $entry_ref;
 
             # if references are equal then we've found
             if ( $entry_ref == $ref ) {
                 $last_pack = $pack;
-                return ( $REF_SYMBOLS{ ref($ref) } || '*' ) . $pack . $k;
+                return ( $REF_SYMBOLS{ $ref_type } || '*' ) . $pack . $k;
             }
         }
         return '';

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


More information about the Rt-commit mailing list