[Rt-commit] rt branch, master, updated. rt-3.9.7-1218-gff8baab
Ruslan Zakirov
ruz at bestpractical.com
Wed Jan 12 09:26:38 EST 2011
The branch, master has been updated
via ff8baab9fc01ed3957e9481d4b5cb25e545fb104 (commit)
from 517b7dda2172e6b10e5936f1606f82262c60cfb9 (commit)
Summary of changes:
lib/RT/Config.pm | 65 +----------------------------------------
sbin/rt-test-dependencies.in | 1 +
2 files changed, 3 insertions(+), 63 deletions(-)
- Log -----------------------------------------------------------------
commit ff8baab9fc01ed3957e9481d4b5cb25e545fb104
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Wed Jan 12 17:25:49 2011 +0300
factor out RT::Config::__GetNameByRef into Symbol::Global::Name
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 4fbd11d..cf24a02 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -51,8 +51,8 @@ package RT::Config;
use strict;
use warnings;
-
use File::Spec ();
+use Symbol::Global::Name;
=head1 NAME
@@ -895,7 +895,7 @@ sub SetFromConfig {
my $opt = $args{'Option'};
my $type;
- my $name = $self->__GetNameByRef($opt);
+ my $name = Symbol::Global::Name->find($opt);
if ($name) {
$type = ref $opt;
$name =~ s/.*:://;
@@ -955,67 +955,6 @@ sub SetFromConfig {
return 1;
}
- our %REF_SYMBOLS = (
- SCALAR => '$',
- ARRAY => '@',
- HASH => '%',
- CODE => '&',
- );
-
-{
- my $last_pack = '';
-
- sub __GetNameByRef {
- my $self = shift;
- my $ref = shift;
- my $pack = shift;
- if ( !$pack && $last_pack ) {
- my $tmp = $self->__GetNameByRef( $ref, $last_pack );
- return $tmp if $tmp;
- }
- $pack ||= 'main::';
- $pack .= '::' unless substr( $pack, -2 ) eq '::';
-
- no strict 'refs';
- my $name = undef;
-
- # scan $pack's nametable(hash)
- foreach my $k ( keys %{$pack} ) {
-
- # The hash for main:: has a reference to itself
- next if $k eq 'main::';
-
- # 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 );
- return $name if $name;
- }
-
- # entry of the table with references to
- # SCALAR, ARRAY... and other types with
- # the same name
- my $entry = ${$pack}{$k};
- next unless $entry;
-
- # get entry for type we are looking for
- # XXX skip references to scalars or other references.
- # Otherwie 5.10 goes boom. may be we should skip any
- # reference
- return if ref($entry) eq 'SCALAR' || ref($entry) eq 'REF';
- my $entry_ref = *{$entry}{ ref($ref) };
- 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 '';
- }
-}
-
=head2 Metadata
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 10fef43..7e53b3d 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -215,6 +215,7 @@ List::MoreUtils
Net::CIDR
Regexp::Common::net::CIDR
Regexp::IPv6
+Symbol::Global::Name
.
$deps{'MASON'} = [ text_to_hash( << '.') ];
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list