Cannot use an undefined hash key

37 views
Skip to first unread message

Andreas

unread,
May 10, 2010, 4:09:04 AM5/10/10
to DBM-Deep
Hi,

the modul is great (true multi-level hash/array support).

I have a problem with undefined hash keys. Here is my test script:

>>>
use strict;

use Fcntl;
use DBM::Deep;

my %string;
tie %string, "DBM::Deep", {file => 'test_memory.db',type => DBM::Deep-
>TYPE_HASH};

my %empty;

print $string{ '' };
print "OK quota\n";
print $string{ $empty{'empty'} };
print "OK empty hash element\n";
<<<

perl test_undef_ref.pl
OK quota
DBM::Deep: Cannot use an undefined hash key. at test_undef_ref.pl line
15

I have the same problem, if I fetch a value from a mysql-db with value
NULL:

Field = Value
empty = NULL

my $ref = $sth->fetchrow_hashref()

print $string{ $$ref{'empty'} };

Is there an option to set undefined hash keys automatically to empty
string?

Greetings
Andy

--
You received this message because you are subscribed to the Google Groups "DBM-Deep" group.
To post to this group, send email to dbm-...@googlegroups.com.
To unsubscribe from this group, send email to dbm-deep+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dbm-deep?hl=en.

Reply all
Reply to author
Forward
0 new messages