exists($tiedhash{$key}) doesn't work with GDBM_File:
use GDBM_File;
my %d;
tie %d, 'GDBM_File', "test.gdbm", GDBM_NEWDB, 0600;
$d{foo} = 'bar';
print exists($d{foo}), "\n";
$ perl e.pl
GDBM_File doesn't define an EXISTS method at e.pl line 7
$
Renaming "exists" to "EXISTS" in GDBM_File.xs fixes it:
--- /d2/src/perl5.001m/ext/GDBM_File/GDBM_File.xs Thu Jun 22 09:54:54 1995
+++ GDBM_File.xs Wed Sep 13 11:00:45 1995
@@ -16,6 +16,7 @@
#define gdbm_DELETE(db,key) gdbm_delete(db,key)
#define gdbm_FIRSTKEY(db) gdbm_firstkey(db)
#define gdbm_NEXTKEY(db,key) gdbm_nextkey(db,key)
+#define gdbm_EXISTS(db,key) gdbm_exists(db,key)
typedef datum gdatum;
@@ -232,7 +233,7 @@
GDBM_File db
int
-gdbm_exists(db, key)
+gdbm_EXISTS(db, key)
GDBM_File db
datum key
But this raises another question, how do I access methods in GDBM_File
if they aren't tie methods?
tie %d, 'GDBM_File', "test.gdbm", GDBM_NEWDB, 0600;
What I have is %d, which is tied internally somewhere to a GDBM_File
object. If I want to call another function in the GDBM_File package,
like sync() or reorganize(), how do I get to the object?
-Andrew
use GDBM_File;
my %d;
tie %d, 'GDBM_File', "test.gdbm", GDBM_NEWDB, 0600;
$d{foo} = 'bar';
print exists($d{foo}), "\n";
$ perl e.pl
GDBM_File doesn't define an EXISTS method at e.pl line 7
$
Renaming "exists" to "EXISTS" in GDBM_File.xs fixes it:
--- /d2/src/perl5.001m/ext/GDBM_File/GDBM_File.xs Thu Jun 22 09:54:54 1995
+++ GDBM_File.xs Wed Sep 13 11:00:45 1995
@@ -16,6 +16,7 @@
#define gdbm_DELETE(db,key) gdbm_delete(db,key)
#define gdbm_FIRSTKEY(db) gdbm_firstkey(db)
#define gdbm_NEXTKEY(db,key) gdbm_nextkey(db,key)
+#define gdbm_EXISTS(db,key) gdbm_exists(db,key)
typedef datum gdatum;
@@ -232,7 +233,7 @@
GDBM_File db
int
-gdbm_exists(db, key)
+gdbm_EXISTS(db, key)
GDBM_File db
datum key
But this raises another question, how do I access methods in GDBM_File
if they aren't tie methods?
tie %d, 'GDBM_File', "test.gdbm", GDBM_NEWDB, 0600;
What I have is %d, which is tied internally somewhere to a GDBM_File
object. If I want to call another function in the GDBM_File package,
like sync() or reorganize(), how do I get to the object?
-Andrew