r319@athlon: dpavlin | 2005-12-19 21:56:13 +0100
[webpac2] / lib / WebPAC / Store.pm
index f46ed2e..b1837c4 100644 (file)
@@ -14,11 +14,11 @@ WebPAC::Store - Store normalized data on disk
 
 =head1 VERSION
 
-Version 0.08
+Version 0.09
 
 =cut
 
-our $VERSION = '0.08';
+our $VERSION = '0.09';
 
 =head1 SYNOPSIS
 
@@ -169,11 +169,11 @@ sub load_ds {
 
        $log->logconfess("can't find database name") unless ($database);
 
-       my $cache_file = "$cache_path/$database/$prefix#$id";
+       my $cache_file = "$cache_path/$database/$prefix/$id";
        $cache_file =~ s#//#/#go;
 
 open(my $fh, '>>', '/tmp/foo');
-print $fh "LOAD $cache_path / $database / $prefix # $id ==> $cache_file\n";
+print $fh "LOAD $cache_path / $database / $prefix / $id ==> $cache_file\n";
 close($fh);
 
        $log->debug("using cache_file $cache_file");
@@ -233,9 +233,13 @@ sub save_ds {
 
        my $prefix = $arg->{prefix} || '';
 
-       my $cache_file = $self->{path} . "/$prefix#" . $arg->{id};
+       my $cache_file = $self->{path} . '/' . $prefix . '/';
        $cache_file =~ s#//#/#go;
 
+       mkpath($cache_file) unless (-d $cache_file);
+
+       $cache_file .= $arg->{id};
+
        $log->debug("creating storable cache file $cache_file");
 
        return store {