From 4959bfc979176e5e43530c9d1382f72109508bba Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Tue, 5 Jul 2011 08:40:13 -0500 Subject: [PATCH] remove WebGUI::Config->readAllConfigs --- lib/WebGUI/Config.pm | 28 +++------------------------- t/Config.t | 3 +-- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/lib/WebGUI/Config.pm b/lib/WebGUI/Config.pm index 7d7df3807..8d896c71b 100644 --- a/lib/WebGUI/Config.pm +++ b/lib/WebGUI/Config.pm @@ -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; diff --git a/t/Config.t b/t/Config.t index 97ea5164c..ee4fb4282 100644 --- a/t/Config.t +++ b/t/Config.t @@ -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")}) {