create var/estraier if it doesn't exist
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 24 Apr 2009 09:37:08 +0000 (09:37 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 24 Apr 2009 09:37:08 +0000 (09:37 +0000)
git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@1148 07558da8-63fa-0310-ba24-9fe276d99e06

lib/WebPAC/Output/Estraier.pm

index fa95063..fbf0900 100644 (file)
@@ -11,6 +11,7 @@ use Data::Dump qw/dump/;
 use LWP;
 use URI::Escape;
 use List::Util qw/first/;
+use File::Path qw/mkpath/;
 use YAML;
 
 =head1 NAME
@@ -294,7 +295,11 @@ sub finish {
        my $self = shift;
        my $log = $self->_get_logger();
 
-       my $path = 'var/estraier/' . $self->{database} . '.yaml';
+       my $path = 'var/estraier';
+
+       mkpath $path unless -e $path;
+
+       $path .= '/' . $self->{database} . '.yaml';
        YAML::DumpFile( $path, $self->{stats} );
        $log->info("created  $path ", -s $path, " bytes");
        $log->debug( dump( $self->{stats} ) );