summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorPaul Marquess <pmarquess@bfsec.bt.co.uk>1997-07-17 22:47:30 +1200
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-08-07 00:00:00 +1200
commita6ed719b27c92569338047d45a029ec503c5d762 (patch)
tree2ae6a9980bf3bfd419ef184c617ff401edb0e1de /ext
parentbcf048824f6b70c34cd93907c3c0731899c231c7 (diff)
downloadperl-a6ed719b27c92569338047d45a029ec503c5d762.tar.gz
DB_File 1.15 patch
This patch for DB_File fixes a few minor bugs and adds the sub-class patch. Patch from Gisle Aas <gisle@aas.no> to suppress "use of undefined value" warning with db_get and db_seq. Patch from Gisle Aas <gisle@aas.no> to make DB_File export only the O_* constants from Fcntl. Removed the DESTROY method from the DB_File::HASHINFO module. Previously DB_File hard-wired the class name of any object that it created to "DB_File". This makes sub-classing difficult. Now DB_File creats objects in the namespace of the package it has been inherited into. p5p-msgid: 9707192117.AA01973@claudius.bfsec.bt.co.uk
Diffstat (limited to 'ext')
-rw-r--r--ext/DB_File/DB_File.pm40
-rw-r--r--ext/DB_File/DB_File.xs16
-rw-r--r--ext/DB_File/typemap2
3 files changed, 38 insertions, 20 deletions
diff --git a/ext/DB_File/DB_File.pm b/ext/DB_File/DB_File.pm
index 2d5e744671..df1593fd65 100644
--- a/ext/DB_File/DB_File.pm
+++ b/ext/DB_File/DB_File.pm
@@ -1,8 +1,8 @@
# DB_File.pm -- Perl 5 interface to Berkeley DB
#
# written by Paul Marquess (pmarquess@bfsec.bt.co.uk)
-# last modified 30th Apr 1997
-# version 1.14
+# last modified 29th Jun 1997
+# version 1.15
#
# Copyright (c) 1995, 1996, 1997 Paul Marquess. All rights reserved.
# This program is free software; you can redistribute it and/or
@@ -98,7 +98,6 @@ sub NotHere
croak ref($self) . " does not define the method ${method}" ;
}
-sub DESTROY { undef %{$_[0]} }
sub FIRSTKEY { my $self = shift ; $self->NotHere("FIRSTKEY") }
sub NEXTKEY { my $self = shift ; $self->NotHere("NEXTKEY") }
sub CLEAR { my $self = shift ; $self->NotHere("CLEAR") }
@@ -146,7 +145,7 @@ use vars qw($VERSION @ISA @EXPORT $AUTOLOAD $DB_BTREE $DB_HASH $DB_RECNO) ;
use Carp;
-$VERSION = "1.14" ;
+$VERSION = "1.15" ;
#typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
$DB_BTREE = new DB_File::BTREEINFO ;
@@ -212,17 +211,13 @@ sub AUTOLOAD {
}
-# import borrowed from IO::File
-# exports Fcntl constants if available.
-sub import {
- my $pkg = shift;
- my $callpkg = caller;
- Exporter::export $pkg, $callpkg, @_;
- eval {
- require Fcntl;
- Exporter::export 'Fcntl', $callpkg, '/^O_/';
- };
-}
+eval {
+ # Make all Fcntl O_XXX constants available for importing
+ require Fcntl;
+ my @O = grep /^O_/, @Fcntl::EXPORT;
+ Fcntl->import(@O); # first we import what we want to export
+ push(@EXPORT, @O);
+};
bootstrap DB_File $VERSION;
@@ -1666,6 +1661,21 @@ Minor changes to DB_FIle.xs and DB_File.pm
Made it illegal to tie an associative array to a RECNO database and an
ordinary array to a HASH or BTREE database.
+=item 1.15
+
+Patch from Gisle Aas <gisle@aas.no> to suppress "use of undefined
+value" warning with db_get and db_seq.
+
+Patch from Gisle Aas <gisle@aas.no> to make DB_File export only the O_*
+constants from Fcntl.
+
+Removed the DESTROY method from the DB_File::HASHINFO module.
+
+Previously DB_File hard-wired the class name of any object that it
+created to "DB_File". This makes sub-classing difficult. Now DB_File
+creats objects in the namespace of the package it has been inherited
+into.
+
=back
=head1 BUGS
diff --git a/ext/DB_File/DB_File.xs b/ext/DB_File/DB_File.xs
index 8d01d91642..d2c7e6c645 100644
--- a/ext/DB_File/DB_File.xs
+++ b/ext/DB_File/DB_File.xs
@@ -3,8 +3,8 @@
DB_File.xs -- Perl 5 interface to Berkeley DB
written by Paul Marquess (pmarquess@bfsec.bt.co.uk)
- last modified 30th Apr 1997
- version 1.14
+ last modified 29th Jun 1997
+ version 1.15
All comments/suggestions/problems are welcome
@@ -42,6 +42,9 @@
1.13 - Tidied up a few casts.
1.14 - Made it illegal to tie an associative array to a RECNO
database and an ordinary array to a HASH or BTREE database.
+ 1.15 - Patch from Gisle Aas <gisle@aas.no> to suppress "use of
+ undefined value" warning with db_get and db_seq.
+
*/
@@ -50,6 +53,9 @@
#include "XSUB.h"
#include <db.h>
+/* #ifdef DB_VERSION_MAJOR */
+/* #include <db_185.h> */
+/* #endif */
#include <fcntl.h>
@@ -87,7 +93,7 @@ typedef DB_File_type * DB_File ;
typedef DBT DBTKEY ;
-/* #define TRACE */
+/* #define TRACE */
#define db_DESTROY(db) ((db->dbp)->close)(db->dbp)
#define db_DELETE(db, key, flags) ((db->dbp)->del)(db->dbp, &key, flags)
@@ -1062,7 +1068,7 @@ int
db_get(db, key, value, flags=0)
DB_File db
DBTKEY key
- DBT value
+ DBT value = NO_INIT
u_int flags
INIT:
CurrentDB = db ;
@@ -1098,7 +1104,7 @@ int
db_seq(db, key, value, flags)
DB_File db
DBTKEY key
- DBT value
+ DBT value = NO_INIT
u_int flags
INIT:
CurrentDB = db ;
diff --git a/ext/DB_File/typemap b/ext/DB_File/typemap
index 5ca9c54f72..a6212243de 100644
--- a/ext/DB_File/typemap
+++ b/ext/DB_File/typemap
@@ -34,3 +34,5 @@ T_dbtkeydatum
OutputKey($arg, $var)
T_dbtdatum
OutputValue($arg, $var)
+T_PTROBJ
+ sv_setref_pv($arg, dbtype, (void*)$var);