[cricket-users] DB_File in cricket-0.64

From: Jost Krieger (Jost.Krieger+onelist@ruhr-uni-bochum.de)
Date: Thu May 20 1999 - 03:11:01 PDT


From: Jost Krieger <Jost.Krieger+onelist@ruhr-uni-bochum.de>

I think using DB_File may be necessary, as records tend to get
largish, but could we agree to use something like the patch below?
(It uses DB_File if available.)

One thing not in it is to ignore every file starting with "config.db".

Unfortunately, I haven't got it running yet (DB_File not installed,
NDBM doesn't cope with the squid proxy record, it seems).

I would personally prefer to use CDB, but I need to test it first.
It's a classical case of a constant database (write once, read often).

Jost

diff -u -r src/cricket-0.64/lib/ConfigTree/Cache.pm cricket-0.64/lib/ConfigTree/Cache.pm
--- src/cricket-0.64/lib/ConfigTree/Cache.pm Mon May 17 20:54:27 1999
+++ cricket-0.64/lib/ConfigTree/Cache.pm Thu May 20 09:36:40 1999
@@ -1,6 +1,7 @@
 package ConfigTree::Cache;

-use DB_File;
+BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File) }
+use AnyDBM_File;
 use POSIX;

 sub DbRef { shift->_getAndSet('DbRef', @_) };
@@ -26,7 +27,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, 'AnyDBM_File', $file, O_RDONLY, 0644;

        $self->DbRef(\%db);
        $self->Dbh($dbh);
diff -u -r src/cricket-0.64/lib/ConfigTree/Node.pm cricket-0.64/lib/ConfigTree/Node.pm
--- src/cricket-0.64/lib/ConfigTree/Node.pm Tue May 18 09:21:11 1999
+++ cricket-0.64/lib/ConfigTree/Node.pm Thu May 20 09:37:01 1999
@@ -3,7 +3,9 @@
 use strict;
 use Text::ParseWords;
 use FileHandle;
-use DB_File;
+BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File NDBM_File) }
+use AnyDBM_File;
+
 use POSIX;

 my($gDebug) = 0;
@@ -153,7 +155,7 @@
     unlink($file);

     my(%db);
- my($dbh) = tie %db, 'DB_File', $file, O_CREAT|O_RDWR, 0644, $DB_HASH;
+ my($dbh) = tie %db, 'AnyDBM_File', $file, O_CREAT|O_RDWR, 0644;

        my($ct) = $self->compileTree(\%db);

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

------------------------------------------------------------------------ Are you hogging all the fun? http://www.onelist.com Friends tell friends about ONElist!



This archive was generated by hypermail 2b29 : Mon Mar 06 2000 - 19:00:49 PST