Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

falling back to SDBM_File if DB_File is not installed

  • Loading branch information...
commit 33cc1b8443e6abe6947c092a65b68b95012b4691 1 parent 896337a
@semuel authored
Showing with 15 additions and 2 deletions.
  1. +1 −1  dist.ini
  2. +14 −1 lib/Dist/Surveyor/DB_File.pm
View
2  dist.ini
@@ -31,7 +31,7 @@ fake_home = 1
[MetaTests]
[PodSyntaxTests]
;[PodCoverageTests]
-[PortabilityTests]
+[Test::Portability]
; metadata
[Prereqs]
View
15 lib/Dist/Surveyor/DB_File.pm
@@ -1,7 +1,20 @@
package Dist::Surveyor::DB_File;
-use base 'DB_File';
+use strict;
+use warnings;
use Storable qw(freeze thaw);
+our @ISA;
+if (eval { require DB_File; 1; }) {
+ @ISA = ('DB_File');
+
+}
+elsif (eval { require SDBM_File; 1; }) {
+ @ISA = ('SDBM_File');
+}
+else {
+ die "Need either DB_file or SDBM_File installed to run";
+}
+
# DB_File can store only strings as values, and not Perl structures
# this small wrapper fixes the problem
Please sign in to comment.
Something went wrong with that request. Please try again.