in reply to newbie: DB versus DIR/PAG database files

Try this -
dbmopen(%DATA, "filename.db", 0600) || die "Darn!";
The .dir and .pag is the ndbm database extension default on the Windows perl platform. Because when you try to open the file "filename" without the ".db" extension, the system will try to find matching "filename.dir" and "filename.pag" by default, when not found, the system will try to create one for you. Thus you need to be more specific and give "filename.db" instead.

Another suggestion: use tie() instead of dbmopen, and also checkout the DB_File (for Berkley DB), DBI/DBD modules on CPAN, which are great for database manipulations.

Replies are listed 'Best First'.
Re: Re: newbie: DB versus DIR/PAG database files
by shenme (Priest) on Sep 23, 2003 at 02:24 UTC
    Tried this on my Win32 system (w/o DB_File installed) and it created "filename.db.pag" and "filename.db.dir".

    After installing module DB_File and adding "use DB_File;" before the dbmopen() AND using "filename.db" instead, a file was created with this name.   But I don't know if this is what the original poster needs - DB_File that is.   He needs to tell us more?

      He needs to tell us more?

      I don't think he does. He's moved his .db files to the new machine, but can't open them with dbmopen() because his version of dbmopen() finds that the .pag and .dir files don't exist and creates them. He needs to switch to DB_File to get the dbmopen() call to find and use the .db file.



      ($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print
        From original submitter:

        Yeah, I guess I need to install DB_File module and use it. Too bad I don't have administrative permissions on this machine. How can I get ahold of an unzipped version of the file "DB_File.pm"? I cannot install WinZip without Admin permissions.

        Kurt