[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] MLDBM crashes MacPerl



At 14.18 -0400 1999.07.02, Erich Rast wrote:
>I have to use the MLDBM 2.00 module to store complex data structures.
>However, when I try to modify a key's value, MacPerl patch level 5.004
>version 5.20r4 crashes with a type 2 error. The following code will crash
>when run the second time:
>
>use MLDBM qw(DB_File);
>tie (%TEST, 'MLDBM', 'test.dbm')
>  or die "Cannot open: $!\n";
>$TEST{'foo'} = 'bar';
>untie %TEST;

It does not crash me.  PowerBook G3/292, Mac OS 8.6, MacPerl 5.2.0r4 PPC.

>Now as my data isn't sooo complex, I use dbmopen with hashes as a
>workaround like this:
>
>$TEST{'name', 'phone'} = $phone;
>
>*But* in my script, the user may use keys the script cannot know in
>advance, and as it turns to be a CGI the script forgets the keys after a
>run, which prevents me from deleting entries with such unknown keys later.
>Is there a safe and easy way to get all keys based on a "first" key? (Like
>in the above example, retrieve any key combinations used after the 'name'
>key, here ['name', 'phone'], based on the 'name'?)

    my @keys = grep /^name$;/, keys %TEST;

$; there is the special variable for multidimensional array emulation.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org