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;
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;