develooper Front page | perl.perl5.porters | Postings from March 2003

Berkely DB Question

Thread Next
From:
John Quigley
Date:
March 17, 2003 12:12
Subject:
Berkely DB Question
Message ID:
58205.216.47.133.61.1047930896.squirrel@host61.grad.iit.edu
I've encountered a funky problem while testing a simple database access
program written in Perl! 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 help would be hugely appreciated!



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About