remove WebGUI::Config->readAllConfigs

This commit is contained in:
Graham Knop 2011-07-05 08:40:13 -05:00
parent 106d888e97
commit 4959bfc979
2 changed files with 4 additions and 27 deletions

View file

@ -21,8 +21,6 @@ use WebGUI::Paths;
use Cwd ();
use File::Spec;
my %config = ();
=head1 NAME
Package WebGUI::Config
@ -35,8 +33,6 @@ This package parses the WebGUI config file.
use WebGUI::Config;
my $configs = WebGUI::Config->readAllConfigs;
my $config = WebGUI::Config->new($configFileName);
my $value = $config->get($param);
@ -94,7 +90,9 @@ sub getCookieTTL {
=head2 new ( configFile )
Returns a hash reference containing the configuration data. It tries to get the data out of the memory cache first, but reads the config file directly if necessary.
Returns a WebGUI::Config object for the given file. The file name
can be either an absolute file path, or a path relative to the
WebGUI configuration directory.
=head3 configFile
@ -110,25 +108,5 @@ around BUILDARGS => sub {
return $class->$orig($filename);
};
#-------------------------------------------------------------------
=head2 readAllConfigs ( )
Reads all the config file data for all defined sites and returns a hash reference containing WebGUI::Config objects keyed by filename. This is a class method.
Example: $configs->{$filename};
=cut
sub readAllConfigs {
my $class = shift;
my @configs = WebGUI::Paths->siteConfigs;
my %configs = map {
$_ => $class->new($_);
} @configs;
return \%configs;
}
1;

View file

@ -11,7 +11,7 @@
use strict;
use WebGUI::Test;
use Test::More tests => 14; # increment this value for each test you create
use Test::More tests => 13; # increment this value for each test you create
use Test::Deep;
use File::Basename qw(basename);
use Cwd;
@ -25,7 +25,6 @@ is( ref $config->get("macros"), "HASH", "get() macros hash" );
is( ref $config->get("assets"), "HASH", "get() assets hash" );
is( ref $config->get("shippingDrivers"), "ARRAY", "get() shippingDrivers array" );
is( $config->getFilename, basename($configFile), "getFilename()" );
ok( defined WebGUI::Config->readAllConfigs, "readAllConfigs" );
$config->addToArray("shippingDrivers","TEST");
my $found = 0;
foreach my $driver ( @{$config->get("shippingDrivers")}) {