DBfile::lock - does not work on a certain server

  • Thread starter Vassilis Tavoultsidis
  • Start date
V

Vassilis Tavoultsidis

I am running the following script on an Apache Server 1.3.27 (Unix) with
Linux as an operating system and perl version 5.006001 (I don't know any
other information I just rent this server) and it dies when I try to tie the
hash with the database.

#!/usr/bin/perl
use CGI;
use Fcntl qw( :DEFAULT :flock);
use DB_File::Lock;

my $q = new CGI;

$temp_data = $ENV{'DOCUMENT_ROOT'};
if($temp_data =~ /\/$/) {
chop($temp_data);
}
print "Content-type: text/html\n\n";

print "DB_File::Lock >>> ";

$db_filename = "${temp_data}/database/epipla";
print "${db_filename}<br>";
tie(%db_hash, 'DB_File::Lock', $db_filename, O_RDONLY, 0755, $DB_HASH,
'read') or die"error";
while (($k, $v) = each(%db_hash))
{
print $k."::".$v."<br>";
};
untie(%db_hash);

print "end";

exit;
 
D

Dan Wilga

Vassilis Tavoultsidis said:
tie(%db_hash, 'DB_File::Lock', $db_filename, O_RDONLY, 0755, $DB_HASH,
'read') or die"error";

If you change this to:

or die "error: $!\n";

you may get more useful informtaion out of it. I would also suggest
running it from the commandline, so you can see the error message right
away (rather than having to look in the server error log.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,600
Members
45,181
Latest member
RexGreenwa
Top