r11528@llin: dpavlin | 2005-12-05 02:30:12 +0100
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 5 Dec 2005 17:47:39 +0000 (17:47 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 5 Dec 2005 17:47:39 +0000 (17:47 +0000)
 create database path if not called with read_only parametar (instead of
 disabling cache) [0.04]

git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@215 07558da8-63fa-0310-ba24-9fe276d99e06

Makefile.PL
lib/WebPAC/Store.pm

index 83f1476..fca110f 100644 (file)
@@ -25,6 +25,7 @@ WriteMakefile(
        'List::Util' => 0,
        'URI::Escape' => 0,
        'LWP' => 0,
+       'File::Path' => 0,
     },
     dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
     clean               => { FILES => 'WebPAC-* pod2html Makefile tags' },
index 9ac11a3..b78a05b 100644 (file)
@@ -5,6 +5,7 @@ use strict;
 
 use base 'WebPAC::Common';
 use Storable;
+use File::Path;
 
 =head1 NAME
 
@@ -12,11 +13,11 @@ WebPAC::Store - Store normalized data on disk
 
 =head1 VERSION
 
-Version 0.03
+Version 0.04
 
 =cut
 
-our $VERSION = '0.03';
+our $VERSION = '0.04';
 
 =head1 SYNOPSIS
 
@@ -88,7 +89,12 @@ sub path {
        if ($dir) {
                my $msg;
                if (! -e $dir) {
-                       $msg = "doesn't exist";
+                       if ($self->{'read_only'}) {
+                               $msg = "doesn't exist";
+                       } else {
+                               $log->info("creating $dir");
+                               mkpath $dir;
+                       }
                } elsif (! -d $dir) {
                        $msg = "is not directory";
                } elsif (! -w $dir) {