Subject: | DBM::Deep 0.99_02 bug ? |
Date: | Fri, 06 Jul 2007 14:53:21 +0200 |
To: | bug-DBM-Deep [...] rt.cpan.org |
From: | "MARCON Michel - CETU/SG/Informatique" <Michel.Marcon [...] equipement.gouv.fr> |
Hello.
Sorry to report the bug here instead ot the web....
DBM::Deep version 0.99_02 under Linux RH 9, Kernel 2.4.20, Perl 5.8.0
idem on Linux Suse 10.2, kernel 2.6.x, Perl 5.8.8
under RH or Suse, test with my module rechercher.cgi and BDM::Deep V0.94
=> OK
under RH or Suse, test with my module rechercher.cgi and BDM::Deep
V0.99_2 => not OK
under RH or Suse, test with my module rechercher.cgi and BDM::Deep
V0.1.x => OK, but actually in test
--------------devices.data-------------8<-------------------------------
172.21.36.106!pc!be.1.008.0i!s3455!gerard.bredillet!en!
172.21.36.20!im!s.b1.2.012.0ij!epl5900a!s.francoise.jacotin!st!
172.21.36.103!pc!be.2.005.0i!p3396bis!veronique.aurand!en!
172.21.36.154!pc!be.0.009.0i!p3416bis!jean-claude.martin!en!
-----------------------------8<------------------------------------------
snippet 1 : creating a db file from a data file.
------------------------8<-------------------
use warnings;
use strict;
use DBM::Deep;
unlink ("devices.db");
my $device = DBM::Deep->new(file=>"devices.db", locking=>1, autoflush=>1);
my ($adresse, $type, $pri, $nom, $ag, $etat);
open (PIN, "<" , "devices.data") || die "open error";
while (<PIN>) {
($adresse, $type, $pri, $nom, $ag, $etat) = split /!/;
$device->put($adresse, {
type=>$type,
prise=>$pri,
nom=>$nom,
agent=>$ag,
etat=>$etat });
}
close PIN;
------------------------8<-------------------
snippet 2, reading data
------------------------8<-------------------
use warnings;
use strict;
use DBM::Deep;
my $device = DBM::Deep->new(file=>"devices.db", locking=>1, autoflush=>1);
my $objet="adresse";
my @nom_objet=qw/172.21.36.20 172.21.37.67 172.21.36.237 172.21.36.240
172.21.36.110 /;
foreach (@nom_objet) {
print $_, " => ", recherche($objet, $_), "\n";
}
#
# followin code is an excerpt form the real app.
# this snippet works ok
#
sub recherche {
my ($p_objet, $p_nomobjet)=@_;
my $flag=0;
if ($p_objet eq "adresse") {
if (! $device->exists($p_nomobjet)) {
return $flag;
}
$flag=1;
# FillHash($p_nomobjet);
return $flag;
}
}
------------------------8<-------------------
On certains conditions, the fonction exists() return incorrect values.
Alas the snippet of code I wrote to give you a clue works OK. But the
real code (rechercher.cgi) doesn't works correctly. It seems that it is
a problem of memory. I could send you the complete example if you want.
However, I switched back to version 0.94 which is OK for me. I'ma
actually testing version 1.x which seems ok too.
Regards
--
Michel Marcon
Sysadmin Un*x & Windows
MEDAD, CETU, UIB
Tel : (33) 04 7214-3408