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

I've encountered a funky problem while testing a simple database access program written in Visual Basic. No I'm just kidding, it's Perl of course! Listen here's the story in brief. I have a Perl cgi script take registered user's names and emails into a database hash. No problem.

Just this morning, to test things, I whipped up a quick and dirty just to see who was currently in the database:
my (%MEMBERS, $member); dbmopen(%MEMBERS, "/httpd/userDBASE/contact", undef) or die "Couldn't open DBASE: $!\n"; for $member(sort keys %MEMBERS) { print "$member ---> $MEMBERS{$member}\n"; } #dmbclose(%MEMBERS);
I know your first complaint is going to be concerning my use of dbmopen (which is deprecated), but the "Llama" tells me to do so, and I follow. Running this script, I do get the output I want, however I get this message:
Use of uninitialized value in subroutine entry at /usr/lib/perl5/5.8.0 +/i686-linux/DB_File.pm line 259.
Yes, I have opened the .pm file and looked at, but the values on 259 are infact initialized? From .pm file:
sub tie_hash_or_array { my (@arg) = @_ ; my $tieHASH = ( (caller(1))[3] =~ /TIEHASH/ ) ; $arg[4] = tied %{ $arg[4] } if @arg >= 5 && ref $arg[4] && $arg[4] =~ /=HASH/ && tied %{ $ +arg[4] } ; # make recno in Berkeley DB version 2 work like recno in version 1 +. if ($db_version > 1 and defined $arg[4] and $arg[4] =~ /RECNO/ and $arg[1] and ! -e $arg[1]) { open( FH, ">$arg[1]") or return undef ; close FH ; chmod $arg[3] ? $arg[3] : 0666 , $arg[1] ; } DoTie_($tieHASH, @arg) ; }
line 259 is that DoTie_ ....
Any thoughts from my fellow monks would hugely ease my troubled mind. I hope this *.pm file doesn't require an exorcism ceremony!

Thank you kindly,
John

update (broquaint): $subject =~ s/Berkley/Berkeley/

Replies are listed 'Best First'.
Re: Berkeley DB Funkiness
by lacertus (Monk) on Mar 17, 2003 at 23:51 UTC
    From POSTER:

    So I managed to get in touch with Paul Marquess (a Perl developer) because I pretty much determined this is a bug, and low and behold it is. From his mouth:

    You can safely ignore the warning if you want. Otherwise upgrade to the latest version of DB_File - which is version 1.807. FYI, this particular problem was fixed in DB_File version 1.805

    The cause for this was the undef in my statement to open the DBASE

    Just information in case someone else runs across this problem in the future!

    ~John
Re: Berkeley DB Funkiness
by pg (Canon) on Mar 17, 2003 at 19:21 UTC
    I seriously suspect that the problem is with $tieHASH, actually that caller(), as there is no guarantee that caller() will return the call frames you want. The frames could be gone, before caller() can catch them.

    I suggest you to dump out $tieHASH.
Re: Berkeley DB Funkiness
by sabkat (Acolyte) on Mar 17, 2003 at 22:34 UTC
    I had a bunch of Berkley DB files crap out on me a week ago. Did this happen right after you installed perl 5.8? The DB version of Berkley may have changed. We did a system upgrade (solaris 8 -> 9) that messed up said DB file. hope that helps
      The said DB file is not messed up (i hope you know this).
      Like the DB_File documentation says

      Note: The database file format has changed multiple times in Berkeley DB version 2, 3 and 4. If you cannot recreate your databases, you must dump any existing databases with either the db_dump or the db_dump185 utility that comes with Berkeley DB. Once you have rebuilt DB_File to use Berkeley DB version 2 or greater, your databases can be recreated using db_load. Refer to the Berkeley DB documentation for further details.


      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.