code cleanup to WebGUI::Paths

This commit is contained in:
Graham Knop 2010-03-18 15:23:05 -05:00
parent 6cbdc3272c
commit a484fb126d
2 changed files with 19 additions and 8 deletions

View file

@ -103,13 +103,15 @@ sub preloadPaths {
my $class = shift;
my @paths;
try {
@paths = grep {
(-d) ? 1 : do {
warn "WARNING: Not adding lib directory '$_' from "
. $class->preloadCustom . ": Directory does not exist.\n";
0;
for my $path ( _readTextLines($class->preloadCustom) ) {
if (-d $path) {
push @paths, $path;
}
} _readTextLines($class->preloadCustom);
else {
warn "WARNING: Not adding lib directory '$path' from "
. $class->preloadCustom . ": Directory does not exist.\n";
}
}
};
return @paths;
}

View file

@ -2,10 +2,10 @@ use 5.010;
use strict;
use warnings;
use Test::More tests => 3;
use Test::More;
use WebGUI::Paths;
can_ok 'WebGUI::Paths', qw(
my @pathMethods = qw(
configBase
logConfig
spectreConfig
@ -17,6 +17,8 @@ can_ok 'WebGUI::Paths', qw(
defaultCreateSQL
var
);
can_ok 'WebGUI::Paths', @pathMethods;
ok !(grep { WebGUI::Paths->can($_) } qw(
croak
realpath
@ -35,3 +37,10 @@ ok !(grep { WebGUI::Paths->can($_) } qw(
my @configs = WebGUI::Paths->siteConfigs;
ok !(\@configs ~~ WebGUI::Paths->spectreConfig), 'Spectre config not listed in configs';
for my $method (@pathMethods) {
my $return = WebGUI::Paths->$method;
ok $return, "$method returns a path";
}
done_testing;