From: Matt S Trout Date: Tue, 26 Aug 2014 14:07:27 +0000 (+0000) Subject: proposed cleanup of _config_files_dor X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=da974328e95b6e31ecf929fd91b5a8f93bd06d00;p=scpubgit%2FApp-SCS.git proposed cleanup of _config_files_dor --- diff --git a/lib/App/SCS/PageSet.pm b/lib/App/SCS/PageSet.pm index f5b9e5e..daac00e 100644 --- a/lib/App/SCS/PageSet.pm +++ b/lib/App/SCS/PageSet.pm @@ -65,26 +65,12 @@ sub _config_files_for { my ($self, $path) = @_; my @files = (); - my @dirs = io->dir($path)->splitdir; + my @dir_parts = io->dir($path)->splitdir; - shift @dirs; - pop @dirs; - my $build_path = io(''); + my @dirs = map io->dir('')->catdir(@dir_parts[1..$_]), 1..($#dir_parts - 1); - foreach my $dir (@dirs) { - $build_path = $build_path->catdir("/$dir"); - #/home/.../share/pages/blog.conf etc - - my $file = $self->_top_dir->catfile("$build_path.conf"); - - if (!$file->exists || !$file->file || $file->empty) { - next; - } - - push @files, $file; - } - - return \@files; + return grep +($_->file and not $_->empty), + map $self->_top_dir->catfile("${_}.conf"), @dirs; } sub _inflate {