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!"
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!"