Support for dbmopen/dbmclose?

A

Amer Neely

I have to do some data mangling in a DBM file but would like to do my
testing on my development system (Win2K running ActiveState Perl 5.8.8).
I've read that this type of database is not supported by Win32, and
according to the ActiveState docs at ASPN:
"Functions obsoleted in perl5

dbmclose, dbmopen
"
So, is is possible for me to work with a DBM file on my development machine?

The script that resides on the Unix server runs fine, but not when I try
to run it here. I've tried

$DBFILE="TKL-db";
dbmopen(%DBF,$DBFILE,0600) or die "Can't open $DBFILE: $!";
and
dbmopen(%DBF,$DBFILE,undef) or die "Can't open $DBFILE: $!";
and
dbmopen(%DBF,"TKL-db",undef) or die "Can't open 'TKL-db': $!";

and get no data when I try to read records from it. The error log shows:
Uncaught exception from user code:
Can't open TKL-db: No such file or directory at test_dbm.pl line 16.


####################### 8X cut here 8X ###################
#! /usr/bin/perl
BEGIN
{
open (STDERR,">>$0-err.txt");
print STDERR "\n",scalar localtime,"\n";
}
use strict;
use warnings;
use diagnostics;

my $DBFILE="TKL-db";
my %DBF;
my ($key,$value,$Counter);

$Counter=0;
dbmopen(%DBF,$DBFILE,0600) or die "Can't open $DBFILE: $!";
while (($key,$value) = each (%DBF))
{
print "$key\n";
$Counter++;
}
dbmclose (%DBF);
print "All done\n$Counter records.";
####################### 8X cut here 8X ###################

--
Amer Neely
w: www.softouch.on.ca/
b: www.softouch.on.ca/blog/
Perl | MySQL programming for all data entry forms.
"We make web sites work!"
 
U

Uri Guttman

AN> I have to do some data mangling in a DBM file but would like to do my
AN> testing on my development system (Win2K running ActiveState Perl
AN> 5.8.8). I've read that this type of database is not supported by
AN> Win32, and according to the ActiveState docs at ASPN:
AN> "Functions obsoleted in perl5

AN> dbmclose, dbmopen

those functions are deprecated for all perl versions. use tie with a
hash instead. that works on all platforms and with many different db
types (some have core modules and others on cpan).

uri
 
A

Amer Neely

Uri said:
AN> I have to do some data mangling in a DBM file but would like to do my
AN> testing on my development system (Win2K running ActiveState Perl
AN> 5.8.8). I've read that this type of database is not supported by
AN> Win32, and according to the ActiveState docs at ASPN:
AN> "Functions obsoleted in perl5

AN> dbmclose, dbmopen

those functions are deprecated for all perl versions. use tie with a
hash instead. that works on all platforms and with many different db
types (some have core modules and others on cpan).

uri

OK, I'll try that. Thanks.

--
Amer Neely
w: www.softouch.on.ca/
b: www.softouch.on.ca/blog/
Perl | MySQL programming for all data entry forms.
"We make web sites work!"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top