[Rt-commit] r8469 - rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Thu Aug 9 01:07:02 EDT 2007
Author: ruz
Date: Thu Aug 9 01:07:02 2007
New Revision: 8469
Modified:
rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Config.pm
Log:
* speed up name space lookups by caching name of
the last package we found ref in
Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Config.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Config.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Config.pm Thu Aug 9 01:07:02 2007
@@ -475,12 +475,18 @@
return 1;
}
+{ my $last_pack = '';
sub __GetNameByRef
{
my $self = shift;
my $ref = shift;
- my $pack = shift || 'main::';
- $pack .= '::' unless $pack =~ /::$/;
+ 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 '::';
my %ref_sym = (
SCALAR => '$',
@@ -497,7 +503,7 @@
# if entry has trailing '::' then
# it is link to other name space
- if( $k =~ /::$/ ) {
+ if ( $k =~ /::$/ ) {
$name = $self->__GetNameByRef($ref, $k);
return $name if $name;
}
@@ -514,11 +520,12 @@
# if references are equal then we've found
if( $entry_ref == $ref ) {
+ $last_pack = $pack;
return ($ref_sym{ref($ref)} || '*') . $pack . $k;
}
}
return '';
-}
+} }
=head2 Metadata
More information about the Rt-commit
mailing list