From: Dobrica Pavlinusic Date: Sun, 6 Jun 2010 12:14:02 +0000 (+0200) Subject: use File::Path mkpath to create export directories X-Git-Url: http://git.rot13.org/?p=MojoFacets.git;a=commitdiff_plain;h=076009f45fce54e79985f25908f891e518a4eac6 use File::Path mkpath to create export directories --- diff --git a/Makefile.PL b/Makefile.PL index 1cf9266..34a5af7 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -20,6 +20,7 @@ WriteMakefile( 'File::Slurp' => 0, 'JSON' => 0, 'HTML::TableExtract' => 0, + 'File::Path' => 0, }, test => {TESTS => 't/*.t t/*/*.t t/*/*/*.t'} ); diff --git a/lib/MojoFacets/Data.pm b/lib/MojoFacets/Data.pm index 5b26968..1afa188 100644 --- a/lib/MojoFacets/Data.pm +++ b/lib/MojoFacets/Data.pm @@ -12,6 +12,7 @@ use locale; use File::Find; use Storable; use Time::HiRes qw(time); +use File::Path qw(mkpath); use MojoFacets::Import::File; use MojoFacets::Import::HTMLTable; @@ -289,11 +290,9 @@ sub _permanent_path { sub _export_path { my $self = shift; - my $path = $self->_param_or_session('path'); - my $dir = $self->app->home->rel_dir('public') . '/export/'; - mkdir $dir unless -e $dir; - $dir .= $path; - mkdir $dir unless -e $dir; + my $path = $self->_param_or_session('path') || die "no path"; + my $dir = $self->app->home->rel_dir('public') . "/export/$path"; + mkpath $dir unless -e $dir; $dir . '/' . join('.', @_); }