Regarding using MLDBM with Storable
Regarding using MLDBM with Storable
am 11.01.2008 13:45:34 von Roman Daszczyszak
I have ActivePerl 5.8.8 build 820 installed, and used ppm to pull down
the MLDBM module. I am trying to use Storable for the data serializer
for MLDBM with a DB_HASH, but when I tried to test it, it returned
this error:
Can't locate auto/Storable/TIEHASH.al in @INC (@INC contains:
C:/Perl/site/lib C:/Perl/lib .) at C:/Perl/site/lib/MLDBM.pm line 143
I'm using the Storable that came with the distribution, so I'm not
sure how to obtain whatever is missing. Can anyone point me in the
right direction?
Here is my test code:
------------------------------------------------------
#!/perl/bin/perl
use strict;
use warnings;
use Data::Compare;
use Data::Dumper;
use MLDBM qw(Storable);
my %database;
unlink "blahfile";
tie (%database, "MLDBM", "blahfile", "O_RDWR|O_CREAT", 0600) or die
"Cannot open file 'blahfile': $!\n";
my $update = 9; # arbitrary number that is not a 1 or 0
my @old = ("00-11-22-33-44-55", "A117", 1, 1197390385, { bob => 23,
alice => 20 });
print("@old", "\n");
my @same = ("00-11-22-33-44-55", "A117", 1, 1197390385, { bob => 23,
alice => 20 });
print("@same", "\n");
my @new = ("00-11-22-33-44-55", "A117", 1, 1197390385, { bob => 23,
alice => 24 });
print("@new", "\n");
$database{"144"} = \@old;
my $test_ref = $database{"144"};
my @test_db = @{$test_ref};
print("\@old = ", Dumper(\@old), "\n");
print("\$database_144 = ", Dumper($database{"144"}), "\n");
------------------------------------------------------
Regards,
Roman
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Regarding using MLDBM with Storable
am 11.01.2008 14:21:04 von Brian Raven
Roman Daszczyszak <> wrote:
> I have ActivePerl 5.8.8 build 820 installed, and used ppm to pull
> down the MLDBM module. I am trying to use Storable for the data
> serializer for MLDBM with a DB_HASH, but when I tried to test it, it
> returned this error: =
> Can't locate auto/Storable/TIEHASH.al in @INC (@INC contains:
> C:/Perl/site/lib C:/Perl/lib .) at C:/Perl/site/lib/MLDBM.pm line 143
> =
> I'm using the Storable that came with the distribution, so I'm not
> sure how to obtain whatever is missing. Can anyone point me in the
> right direction? =
> =
> Here is my test code:
> ------------------------------------------------------
> #!/perl/bin/perl
> use strict;
> use warnings;
> =
> use Data::Compare;
> use Data::Dumper;
> use MLDBM qw(Storable);
It looks like MLDBM expects the first 'use' parameter to be the DB
package, and the second to be the serializer, although I don't think
that is made very clear in the documentation. At least, that would be my
guess from a quick look at the import function.
See the examples in the documentation. They either have no 'use'
parameters or 2, e.g.
use MLDBM qw(DB_File Storable);
Either that, or try the UseDB and/or Serializer methods.
As an aside, it does seem quite old. Untouched for over 5 years. Still,
if it does the job ...
HTH
-- =
Brian Raven =
==================== =====3D=
================
Atos Euronext Market Solutions Disclaimer
==================== =====3D=
================
The information contained in this e-mail is confidential and solely for the=
intended addressee(s). Unauthorised reproduction, disclosure, modification=
, and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediat=
ely and delete it from your system. The views expressed in this message do =
not necessarily reflect those of Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited - Registered in England & Wales with=
registration no. 3962327. Registered office address at 25 Bank Street Lon=
don E14 5NQ United Kingdom. =
Atos Euronext Market Solutions SAS - Registered in France with registration=
no. 425 100 294. Registered office address at 6/8 Boulevard Haussmann 750=
09 Paris France.
L'information contenue dans cet e-mail est confidentielle et uniquement des=
tinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. Tou=
te copie, publication ou diffusion de cet email est interdite. Si cet e-mai=
l vous parvient par erreur, nous vous prions de bien vouloir prevenir l'exp=
editeur immediatement et d'effacer le e-mail et annexes jointes de votre sy=
steme. Le contenu de ce message electronique ne represente pas necessaireme=
nt la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Soci=E9t=E9 de droit anglais, enregi=
str=E9e au Royaume Uni sous le num=E9ro 3962327, dont le si=E8ge social se =
situe 25 Bank Street E14 5NQ Londres Royaume Uni.
Atos Euronext Market Solutions SAS, soci=E9t=E9 par actions simplifi=E9e, e=
nregistr=E9 au registre dui commerce et des soci=E9t=E9s sous le num=E9ro 4=
25 100 294 RCS Paris et dont le si=E8ge social se situe 6/8 Boulevard Hauss=
mann 75009 Paris France.
==================== =====3D=
================
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Regarding using MLDBM with Storable
am 11.01.2008 14:51:14 von Mark Knoop
Roman Daszczyszak <> wrote:
> I have ActivePerl 5.8.8 build 820 installed, and used ppm to pull
> down the MLDBM module. I am trying to use Storable for the data
> serializer for MLDBM with a DB_HASH, but when I tried to test it, it
> returned this error:
> Can't locate auto/Storable/TIEHASH.al in @INC (@INC contains:
> C:/Perl/site/lib C:/Perl/lib .) at C:/Perl/site/lib/MLDBM.pm line 143
>
> I'm using the Storable that came with the distribution, so I'm not
> sure how to obtain whatever is missing. Can anyone point me in the
> right direction?
>
> Here is my test code:
> ------------------------------------------------------
> #!/perl/bin/perl
> use strict;
> use warnings;
>
> use Data::Compare;
> use Data::Dumper;
> use MLDBM qw(Storable);
It looks like MLDBM expects the first 'use' parameter to be the DB
package, and the second to be the serializer, although I don't think
that is made very clear in the documentation. At least, that would be my
guess from a quick look at the import function.
See the examples in the documentation. They either have no 'use'
parameters or 2, e.g.
use MLDBM qw(DB_File Storable);
Either that, or try the UseDB and/or Serializer methods.
As an aside, it does seem quite old. Untouched for over 5 years. Still,
if it does the job ...
### New reply - not sure why Brian's emails don't automatically get >
indented?? ###
I had a similar issue with this some time back - the code which I was using
(from someone elses example script) was:
eval {
BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File SDBM_File) };
use AnyDBM_File;
use MLDBM qw(AnyDBM_File Storable);
use Fcntl qw(:DEFAULT :flock);
};
but it was fixed by installing DB_File. I don't really understand what is
going on though.
For what its worth I have since used DBM::Deep in similar situations which I
found much simpler.
Mark
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Regarding using MLDBM with Storable
am 11.01.2008 22:03:27 von Roman Daszczyszak
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
> > It looks like MLDBM expects the first 'use' parameter to be the DB
> > package, and the second to be the serializer, although I don't think
> > that is made very clear in the documentation. At least, that would be my
> > guess from a quick look at the import function.
> >
> > See the examples in the documentation. They either have no 'use'
> > parameters or 2, e.g.
> >
> > use MLDBM qw(DB_File Storable);
I'll try reversing the parameters then; thanks!
> >
> > Either that, or try the UseDB and/or Serializer methods.
> >
> > As an aside, it does seem quite old. Untouched for over 5 years. Still,
> > if it does the job ...
> >
> ### New reply - not sure why Brian's emails don't automatically get >
> indented?? ###
>
> I had a similar issue with this some time back - the code which I was
using
> (from someone elses example script) was:
>
> eval {
> BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File SDBM_File) };
> use AnyDBM_File;
> use MLDBM qw(AnyDBM_File Storable);
> use Fcntl qw(:DEFAULT :flock);
> };
>
> but it was fixed by installing DB_File. I don't really understand what is
> going on though.
>
> For what its worth I have since used DBM::Deep in similar situations
which I
> found much simpler.
>
> Mark
I have also been using DBM::Deep for awhile, however recently I've been
running into trouble with it, coupled with Data::Compare.
I have a database that I use to store information about all the
workstations I manage. Recently, I added pulling the local user
information, which is returned as a hash by Win32API. Storing this as
an additional element to the arrays stored in the DBM::Deep hash is not
a problem, but when I try to compare newly acquired data (in a regular
hash data structure) with the stuff stored in the DBM::Deep database,
Data::Compare returns a false (non-match) even when the data is
identical. I traced it to the fact that the database hash references
are 'DBM::Deep::Hash' types, and that Data::Compare does not compare
them correctly with normal (complex) hash structures.
Writing a plug-in for Data::Compare to correctly handle DBM::Deep
references might be good, but I don't think I'm up to the task yet.
Copying the hash structure from the DBM::Deep database does not fix the
problem; all references remain pointed to the db. I tried to 'cheat' by
assigning the temporary new information to the database, which allows
the compare to work correctly, but then when trying to update the
original database entry, I get a 'Cannot store tied value' because the
references are already set to point to another part of the db.
So, in looking for help on the perl beginners list (beginners@perl.org),
I was advised to try a different database and serialize it. Which
leaves me with the above error.
Also I learned today (from writing the DBM::Deep maintainer) that the
way to handle the tied references is to use DBM::Deep's export(), though
this exports the entire database, which is not really what I would like
to do... but, if I cannot get another db to work, I will likely give up
and go that route.
If you're curious, you can see my prior attempts in the
beginners@perl.org mail archive.
I also have tried using BerkeleyDB::Hash with FreezeThaw and MLDBM, but
that is giving me a different error entirely (cannot create second-level
tie or somesuch; I don't have it in front of me at the moment)
End result, my simple script change has been a week of bugs instead...
though, I'm learning more about Perl at least. :)
Any suggestions appreciated.
Regards,
Roman
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)
iD8DBQFHh9mff1ZCgXADleARCuVyAKClPaABw4Pzd+1hT0vb8m04agEVLACf Xup/
IOUUPc77NSYYjujA1SxiGOM=
=//qg
-----END PGP SIGNATURE-----
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs