From: Jost Krieger <Jost.Krieger+onelist@ruhr-uni-bochum.de>
Since last Friday I have been running a quick-and-dirty CDB version or
cricket 0.65:
The dirty part concerns that it compiles to memory. So you probably
shouldn't use this for really large sites.
And please don't remove the stringification of $mtime. There seems to
be a problem in CDB_File with values that have never been strings.
Here's the patch:
diff -ur src/cricket-0.65/lib/ConfigTree/Cache.pm cricket/lib/ConfigTree/Cache.pm
--- src/cricket-0.65/lib/ConfigTree/Cache.pm Mon May 17 20:54:27 1999
+++ cricket/lib/ConfigTree/Cache.pm Fri May 21 12:28:17 1999
@@ -1,6 +1,6 @@
package ConfigTree::Cache;
-use DB_File;
+use CDB_File;
use POSIX;
sub DbRef { shift->_getAndSet('DbRef', @_) };
@@ -26,7 +26,7 @@
my($self) = @_;
my($file) = $self->Base() . "/config.db";
- my($dbh) = tie %db, 'DB_File', $file, O_RDONLY, 0644, $DB_HASH;
+ my($dbh) = tie %db, 'CDB_File', $file;
$self->DbRef(\%db);
$self->Dbh($dbh);
@@ -135,7 +135,7 @@
if (defined($mtime2)) {
if ($mtime > $mtime2) {
return (1,
- "File $file is newer than the compiled version.");
+ "File $file is newer ($mtime) than the compiled version ($mtime2).");
}
} else {
return (1, "Missing file mtime for file $file");
diff -ur src/cricket-0.65/lib/ConfigTree/Node.pm cricket/lib/ConfigTree/Node.pm
--- src/cricket-0.65/lib/ConfigTree/Node.pm Thu May 20 00:41:02 1999
+++ cricket/lib/ConfigTree/Node.pm Wed May 26 16:02:00 1999
@@ -3,7 +3,7 @@
use strict;
use Text::ParseWords;
use FileHandle;
-use DB_File;
+use CDB_File;
use POSIX;
my($gDebug) = 0;
@@ -156,7 +156,6 @@
unlink($file);
my(%db);
- my($dbh) = tie %db, 'DB_File', $file, O_CREAT|O_RDWR, 0644, $DB_HASH;
my($ct) = $self->compileTree(\%db);
@@ -172,7 +171,7 @@
# we get a message about inner references. Whatever. Forget it.
# untie %db;
- rename($file, $finalFile);
+ CDB_File::create %db, $finalFile, $file;
return ($ct, $#f+1);
}
@@ -304,10 +303,11 @@
my($fd) = $fh->fileno();
my($mtime) = (POSIX::fstat($fd))[9];
+ # $self->Debug("Time is $mtime");
if (! defined($mtime)) {
$self->Warn("Could not get mtime for file $file.");
} else {
- ($self->Files())->{$file} = $mtime;
+ ($self->Files())->{$file} = "$mtime";
}
$fh->close();
-- | Jost.Krieger@ruhr-uni-bochum.de Please help stamp out spam! | | Postmaster, JAPH, resident answer machine am RZ der RUB | | non sunt multiplicanda entia praeter necessitatem | | William of Ockham (1285-1347/49) |------------------------------------------------------------------------ What was YOUR favorite part?! http://www.onelist.com Tell other Star Wars fans at ONElist!
This archive was generated by hypermail 2b29 : Mon Mar 06 2000 - 19:00:51 PST