talk2kvj has asked for the wisdom of the Perl Monks concerning the following question:

I posted this message already but, its still not working. it still says "cant open file". I guess it must be problem with the DB_FILE module. I installed it as per the readme.txt in the DB_FILE module. I read the documentation too. Do I need to set a link or path variables etc..Would perl automatically recognize the DB_FILE module, no matter where it is installed. Is it necessary to install the DB_FILE module separately, even though perl comes with it..and i have Berkeley4.x installed and perl-DB_FILE1.808. the documentation says, it should work even with BerkeleyDB2.x or 3.x . thanks in advance
use DB_File; use CGI; use DirHandle; use FileHandle; dbmopen(%TEST, "/home/lab/history.db", 0666) or die "Can't open histor +y file: $!"; while (($key,$val) = each %TEST) { print $key, ' = ', unpack('L',$val), "\n"; } dbmclose(%TEST);

Replies are listed 'Best First'.
Re: problem with DB_FILE
by pfaut (Priest) on Jun 03, 2004 at 23:25 UTC

    Does this CGI script run under your account or under the webserver account? If the latter, does the webserver account have permissions to access the /home/lab directory and the db files?

    90% of every Perl application is already written.
    dragonchild
Re: problem with DB_FILE
by hsinclai (Deacon) on Jun 04, 2004 at 04:28 UTC
    Hm, tried your code with some existing files I had..

    Got segmentation faults on some of them.

    Then I recreated the .db file, and ba da bing ba da boom.

    Did you try with a new history.db, or a different .db file, just out of curiosity?