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

I'm using a NDBM database to make some URL subtitutions with mod_rewrite under Apache. And this database should be written using some Perl script that looks like:
use DB_File; $error=0; tie %h, "NDBM_File", $dbname, O_RDWR, 0640, $DB_HASH or $error=1; if ($error==1) { print "error opening database: $!\n"; exit(0); }
But when I try to run this , the script hangs with
Can't locate object method "TIEHASH" via package "NDBM_File" at ...
I'm using Perl 5.8.0 on an out-of-box RH 8.0.
If you got any hints, I would appreciate the effort.

Thanks.

Replies are listed 'Best First'.
Re: NDBM_File
by PodMaster (Abbot) on Mar 14, 2003 at 13:52 UTC
    Thats because you use DB_File and not NDBM_File.


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      Even with
      use NDBM_File;
      I get the same. On the other hand, it seems to me that (at least on my site) DB_File handles transparently all NDBM_File requestes to the NDBM_File package...
        Then you don't have NDBM_File properly installed.

        DB_File has nothing to do with NDBM_File (except that they both implement the tie interface), so whatever you mean by your last sentance cannot possibly happen.


        MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
        I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
        ** The Third rule of perl club is a statement of fact: pod is sexy.