I've been trying to get BerkeleyDB and mod_perl to work together for a
web database. I'm using BerkeleyDB version 3.1.14 on a RedHat 6.1 based
system with a stock kernel under apache 1.3.12 and mod_perl 1.21. I wrote
a simple script to open a berkeley database, read all variables then write
one.. When running under mod_perl I get the following error from apache:
[Sun Jun 25 20:38:28 2000] [error] Can't locate object method "TIEHASH"
via package "BerkeleyDB::Hash" at /home/httpd/cgi-bin/dbtest.pl line 9.
but when I run the same script (with mod_perl stuff commented out) under
the shell it works fine. The script is included below. I've tried running
the scipt as nobody to see if there is a permissions problem but the shell
version works fine. I'm at a complete loss as to what the problem might
be, any help would be *greatly* appreciated..
--- Begining of code ---
#!/usr/bin/perl -w
use Apache::Constants; # Commented out for shell version
use BerkeleyDB;
my $r = Apache->request; # Commented out for shell version
$r->content_type("text/html"); # Commented out for shell version
$r->send_http_header(); # Commented out for shell version
my $filename = "/tmp/testdb";
tie %h, "BerkeleyDB::Hash",
-Filename => $filename,
-Flags => DB_CREATE
or die "Can't open $filename: $! $BerkeleyDB::Error\n";
while (($k, $v) = each %h) {
print "$k -> $v\n";
}
$h{"apple"} = "red";
untie %h
--- End of code ---
Thanks in advance,
GeoffEG
--
Geoffrey Gallaway || This may seem a bit weird, but that's okay, because it
[EMAIL PROTECTED] || is weird.
D e v o r z h u n || -- Tom Christiansen