From ea6ce64dda40ffaa82846103d02a9c7668bd2a44 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Thu, 16 Jan 2014 19:27:01 +0200 Subject: [PATCH] Gruntmaster::Page::generate should mkdir -p before generating --- lib/Gruntmaster/Page.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.39.2