[Rt-commit] rt branch, 4.0/global-vars-name-lookup, created. rt-4.0.8rc1-5-g6138160

Ruslan Zakirov ruz at bestpractical.com
Mon Oct 22 10:51:31 EDT 2012


The branch, 4.0/global-vars-name-lookup has been created
        at  6138160bc671f4cffeea563d9bde88aaf86c94ea (commit)

- Log -----------------------------------------------------------------
commit 54b4ec046393b217faa9316c75b6cb6f050fc02d
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Oct 22 18:40:48 2012 +0400

    fix nesting when we lookup in stashes by reference
    
    it worked fine for RT as we look into RT::, but not deeper

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index ba338bb..aa4771e 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1204,7 +1204,7 @@ sub SetFromConfig {
             # if the entry has a trailing '::' then
             # it is a link to another name space
             if ( substr( $k, -2 ) eq '::') {
-                $name = $self->__GetNameByRef( $ref, $k );
+                $name = $self->__GetNameByRef( $ref, $pack eq 'main::'? $k : $pack.$k );
                 return $name if $name;
             }
 

commit 6138160bc671f4cffeea563d9bde88aaf86c94ea
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Oct 22 18:45:23 2012 +0400

    Fix name lookup by reference to a reference.
    
    References to references are of REF "type" (ref($...) eq 'REF'), but
    they are stored in SCALAR slot.
    
    For example options that store qr{} or sub references were
    not working properly in corner cases. For example if such
    option is set and some config tries to change it later then
    new Set invocation just fails to find name of the option.

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index aa4771e..8534af7 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1176,6 +1176,7 @@ sub SetFromConfig {
             ARRAY  => '@',
             HASH   => '%',
             CODE   => '&',
+            REF    => '$',
         );
 
 {
@@ -1219,7 +1220,7 @@ 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 $entry_ref = *{$entry}{ ref($ref) eq 'REF'? 'SCALAR' : ref($ref) };
             next unless $entry_ref;
 
             # if references are equal then we've found

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


More information about the Rt-commit mailing list