From: Marius Gavrilescu Date: Thu, 16 Jan 2014 17:27:01 +0000 (+0200) Subject: Gruntmaster::Page::generate should mkdir -p before generating X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=ea6ce64dda40ffaa82846103d02a9c7668bd2a44;p=gruntmaster-page.git Gruntmaster::Page::generate should mkdir -p before generating --- diff --git a/lib/Gruntmaster/Page.pm b/lib/Gruntmaster/Page.pm index d3d2506..953d8ae 100644 --- a/lib/Gruntmaster/Page.pm +++ b/lib/Gruntmaster/Page.pm @@ -8,6 +8,7 @@ our @EXPORT_OK = qw/generate _generate/; use Fcntl qw/:flock/; use File::Basename qw/fileparse/; +use File::Path qw/make_path/; use File::Slurp qw/write_file/; use IO::Compress::Gzip qw/gzip/; use IO::File; @@ -49,7 +50,8 @@ sub declaregen{ sub _generate{ my ($path) = @_; my ($path_noext, $ext) = $path =~ m/^(.*)\.(.*)$/; - my $basename = fileparse $path_noext; + my ($basename, $directories) = fileparse $path_noext; + make_path $directories; IO::File->new(">$path_noext.var")->close unless -f "$path_noext.var"; flock my $lockfh = IO::File->new("<$path_noext.var"), LOCK_EX;