in reply to dbmopen does not work

What is the bareword param there for? Shouldn't this be a hash?

Are you checking for failure and printing an error message? That error message will probably help you a lot more than we can, given the information we have.

dbmopen(%hash, $config_file, 0666) or die "Couldn't open DBM: $!";
Note that dbmopen has been "largely superceded by tie":
use NDBM_File; use Fcntl; tie(%hash, 'NDBM_File', $config_file, O_RDWR|O_CREAT, 0640) or die "Couldn't open NDBM: $!";
If this is a CGI script you may need to examine the server error logs for the resulting error messages, or use something like CGI::Carp to send them to the browser:
use CGI::Carp 'fatalsToBrowser';

Replies are listed 'Best First'.
Re: Re: dbmopen does not work
by sinan (Sexton) on Nov 19, 2000 at 22:57 UTC
    Thanks a lot for telling me about CGI::Carp. It really helped. But here is the error message:
    No such file or directory at /blah/blah/blah/cgi-bin/configure_counter +.pl line 54.
    I think that dbmopen is ougth to create the file... Is that wrong?
    param is a hash, but I think that you do not need to put the % at the beginning. Anyway, I tried it, still the same message.

    I need to finish this in a hurry, so I cannot user tie now, but next time I will.

    Thanks a lot for your help, Sinan
      Does your script have permissions to write to that directory? Most web configurations set themselves up so that they are restricted in what they can do/write. I believe dbmopen gives you a "No such file or directory" error instead of "Permission denied" if it simply cannot create the file due to a problem of this nature.

      Check your ownerships and permissions of the directory you're attempting to write to. You may have to create a new directory for CGI data files in such a way that the user the web server is running as can write to it.

      That, or use /tmp.

        I am on my own server, the location for the file is:
        /data/

        I have created the directory myself and its permissions are 755. So it cannot be a problem of permissions.

        Thanks a lot,
        Sinan