Added setNamespace and getNamespace methods to WebGUI::International.
Added a baseline test for WebGUI::International which also tests the new methods. Fixed codespace caching in WebGUI::Operation::Help. Codespace caching is done via symbol table lookups, and it saves doing an eval. Implemented the same type of caching in WebGUI::International. This replaced the in-memory cache which would slowly accumulate a complete copy of the i18n entries as they were fetched.
This commit is contained in:
parent
2f1408e852
commit
85eb6ddbeb
4 changed files with 98 additions and 7 deletions
|
|
@ -10,7 +10,7 @@ package WebGUI::Operation::Help;
|
|||
# http://www.plainblack.com info@plainblack.com
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use strict qw(vars subs);
|
||||
use Tie::IxHash;
|
||||
use WebGUI::AdminConsole;
|
||||
use WebGUI::International;
|
||||
|
|
@ -41,7 +41,12 @@ been already and logs errors during the load.
|
|||
sub _loadHelp {
|
||||
my $session = shift;
|
||||
my $helpPackage = shift;
|
||||
return $helpPackage::HELP if defined $helpPackage::HELP; ##Already loaded
|
||||
if (defined *{"$helpPackage\::HELP"}) { ##Symbol table lookup
|
||||
our $table;
|
||||
*table = *{"$helpPackage\::HELP"}; ##Create alias into symbol table
|
||||
return $table; ##return whole hashref
|
||||
}
|
||||
$session->errorHandler->warn("cache miss for $helpPackage");
|
||||
my $load = sprintf 'use %-s; $%-s::HELP', $helpPackage, $helpPackage;
|
||||
my $help = eval($load);
|
||||
if ($@) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue