[perl #114350] add exportable PAGFEXT, DIRFEXT and PAIRMAX constants
authorTony Cook <tony@develop-help.com>
Thu, 5 Dec 2013 04:01:11 +0000 (15:01 +1100)
committerTony Cook <tony@develop-help.com>
Tue, 17 Dec 2013 22:16:01 +0000 (09:16 +1100)
MANIFEST
ext/SDBM_File/SDBM_File.pm
ext/SDBM_File/SDBM_File.xs
ext/SDBM_File/t/constants.t [new file with mode: 0644]

index 9e26312..435db6c 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -3787,6 +3787,7 @@ ext/SDBM_File/sdbm/sdbm.c SDBM kit
 ext/SDBM_File/sdbm/sdbm.h      SDBM kit
 ext/SDBM_File/sdbm/tune.h      SDBM kit
 ext/SDBM_File/sdbm/util.c      SDBM kit
+ext/SDBM_File/t/constants.t    See if SDBM_File constants work
 ext/SDBM_File/t/sdbm.t         See if SDBM_File works
 ext/SDBM_File/typemap          SDBM extension interface types
 ext/Sys-Hostname/Hostname.pm   Sys::Hostname extension Perl module
index d369b54..5f7bc77 100644 (file)
@@ -7,7 +7,10 @@ require Tie::Hash;
 require XSLoader;
 
 our @ISA = qw(Tie::Hash);
-our $VERSION = "1.10";
+our $VERSION = "1.11";
+
+our @EXPORT_OK = qw(PAGFEXT DIRFEXT PAIRMAX);
+use Exporter "import";
 
 XSLoader::load();
 
index 2da097e..d47e726 100644 (file)
@@ -124,3 +124,11 @@ filter_fetch_key(db, code)
        SDBM_File::filter_store_value = store_value
        CODE:
            DBM_setFilter(db->filter[ix], code);
+
+BOOT:
+        {
+            HV *stash = gv_stashpvs("SDBM_File", 1);
+            newCONSTSUB(stash, "PAGFEXT", newSVpvs(PAGFEXT));
+            newCONSTSUB(stash, "DIRFEXT", newSVpvs(DIRFEXT));
+            newCONSTSUB(stash, "PAIRMAX", newSVuv(PAIRMAX));
+        }
diff --git a/ext/SDBM_File/t/constants.t b/ext/SDBM_File/t/constants.t
new file mode 100644 (file)
index 0000000..dcb10d9
--- /dev/null
@@ -0,0 +1,16 @@
+#!./perl
+use strict;
+use Test::More tests => 4;
+
+use SDBM_File;
+
+# has always been .pag
+is(SDBM_File::PAGFEXT, ".pag", "PAGFEXT");
+
+# depends on the platform
+like(SDBM_File::DIRFEXT, qr/^\.(?:sdbm_)?dir$/, "DIRFEXT");
+
+is(SDBM_File::PAIRMAX, 1008, "PAIRMAX");
+
+ok(eval { SDBM_File->import(qw(PAIRMAX PAGFEXT DIRFEXT)); 1 }, "exportable");
+