[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Quick DB_File questions



I'm running into some confusing things using DB_File: I appear only to
be able to create and use one file, ever (not just at a time).  I
thought that the new implementation allowed having multiple
DB files open at once.  I keep getting:
# DB_File::new failed, reason: error #002.

But can't figure out how to find out what #002 means.

What am I doing wrong?

Examples:
  o after creating a DB file, if I drag it to the Trash, then
    even after quitting and restarting MacPerl, I can no longer
    create such a file again.  (I even restarted my Mac in between.)
    If I move it back from the Trash, I can use it again.  I get
   this error:
# DB_File::new failed, reason: error #002.

  o I get the same error as above when I try to open a second file:

Here's an example:
-=-=-
use DB_File;
$DB_Type = "DB_File";

$dbm_file = 'newfile';
$A = tie %ALIASES, $DB_Type, $dbm_file, 1, 0
	or die "Can't open $dbm_file for ALIASES: $!\n";

$dbm_file2 = 'aliases2';
tie %ALIASES2, $DB_Type, $dbm_file2, O_RDWR|O_CREAT, 0664
	or die "Can't open $dbm_file2 for ALIASES: $!\n";

print "\nALIASES (stored):\n";
while (($key, $val) = each %ALIASES) {
	print $key, ' = ', $val, "\n";
};

$ALIASES{willn} =	"willie";
$ALIASES2{willn} =	"william";
$ALIASES{scottm} =	"scooter";
$ALIASES{daveb} =	"david";

$A->del("daveb");

print "ALIASES:\n";
while (($key, $val) = each %ALIASES) {
	print $key, ' = ', $val, " ", $ALIASES2{$key}, "\n";
	};
untie %ALIASES;
untie %ALIASES2;
-=-=-

Here's how I initially built the file:
-=-=-
use DB_File;
$my_DB_file = "DB_File";

$dbm_file = 'anotheraliases';
tie %ALIASES, $my_DB_file, $dbm_file, 1, 0
	or die "Can't open $dbm_file for ALIASES: $!\n";

$ALIASES{willn} = "willie";
print "ALIASES:\n";
while (($key, $val) = each %ALIASES) {
	print $key, ' = ', $val, "\n";
	};
untie %ALIASES;
-=-=-

_______
Will Neuhauser              willn@quando.com
Chief Technical Officer, VP Development
Quando, Inc.                Tel: 1 (503) 225-1988
520 NW Davis Street         Fax: 1 (503) 225-1987
Portland, OR  97209 USA



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch