Re: mldbm error
From: JS (vervoom_at_hotmail.com)
Date: 10/31/03
- Next message: Ste: "Aps and Linux"
- Previous message: Ben Morrow: "Re: newbie pass variables on CGI"
- In reply to: Ben Morrow: "Re: mldbm error"
- Next in thread: Ben Morrow: "Re: mldbm error"
- Reply: Ben Morrow: "Re: mldbm error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Oct 2003 11:18:52 +0000
Ben Morrow wrote:
> vervoom@hotmail.com wrote:
>
>>I have some code to print from a multi-level hash that has been stored
>>using mldbm:
>>
>>use MLDBM qw(DB_File Storable);
>>tie my %appstaffwk, 'MLDBM', $appstaffwkdb or die $!;
>>
>>foreach $app (keys %appstaffwk){
>> $hashref=$appstaffwk{$app};
>> foreach $staffno (keys %$hashref){
>> print "\n$app:$staffno:$hashref->{$staffno}";
>> }
>>}
>>
>
> <snip>
>
>>It gives me the below error (when I have diagnostics switched on):
>>
>
> <snip>
>
>> Uncaught exception from user code:
>> Storable binary image v24.8 more recent than I am (v2.6) at
>>blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/thaw.al)
>>line 364.
>
>
> I'm sorry to say this, but it looks to me like your database is
> corrupt. Storable seems to think that the data stored in the database
> was created by Storable.pm v24.8, but that won't be written for
> really *quite* some time...
>
> What happens when you run the following:
>
> use Data::Dumper;
> use MLDBM qw/DB_File Storable/;
>
> tie my %appstaffwk, MLDBM => $appstaffwkdb or die "tie failed: $!";
>
> for (keys %appstaffwk) {
> eval {
> print Dumper $appstaffwk{$_};
> 1;
> } or warn "\$appstaffwk{$_} is corrupt!\n";
> }
>
> __END__
>
> The eval{} is there so that if some of the entries are corrupt and
> others aren't, it'll carry on and try them all rather than dieing
> after the first.
>
> Ben
>
Thanks, you were right, the database was corrupted. I'm going to start
over again.
I just wondered, when I store my hash %appstaffwk which has 2 levels -
$appstaffwk{$app}{$staffno} my script which usually runs in 1 minute,
takes about 30 minutes. Is that normal? This is the code I've been using
to store the hash:
my $tmp=$appstaffwk{$app};
if (! defined $tmp->{$staffno}){
$tmp->{$staffno}=1;
$appstaffwk{$app}=$tmp;
}
It doesn't work if you just do:
$appstaffwk{$app}{$staffno}=1;
Is there anything I can do to make the hash storage faster?
Thanks,
JS.
- Next message: Ste: "Aps and Linux"
- Previous message: Ben Morrow: "Re: newbie pass variables on CGI"
- In reply to: Ben Morrow: "Re: mldbm error"
- Next in thread: Ben Morrow: "Re: mldbm error"
- Reply: Ben Morrow: "Re: mldbm error"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|