Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 5.6 support (without unicode features) #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
.*.sw?
Build
MYMETA.*
Makefile
_build/
blib/
pm_to_blib
00*.patch
2 changes: 1 addition & 1 deletion Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ my $build = Module::Build->subclass(
module_name => 'DBM::Deep',
license => 'perl',
requires => {
'perl' => '5.008_004',
'perl' => '5.006',
'Fcntl' => '0.01',
'Scalar::Util' => '1.14',
'Digest::MD5' => '1.00',
Expand Down
10 changes: 7 additions & 3 deletions lib/DBM/Deep.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand All @@ -26,8 +26,12 @@ sub TYPE_ARRAY () { DBM::Deep::Engine->SIG_ARRAY }

my %obj_cache; # In external_refs mode, all objects are registered here,
# and dealt with in the END block at the bottom.
use constant HAVE_HUFH => scalar eval{ require Hash::Util::FieldHash };
HAVE_HUFH and Hash::Util::FieldHash::fieldhash(%obj_cache);
BEGIN {
sub HAVE_HUFH { scalar eval{ require Hash::Util::FieldHash; };}
}
if (HAVE_HUFH) {
Hash::Util::FieldHash::fieldhash(%obj_cache);
}

# This is used in all the children of this class in their TIE<type> methods.
sub _get_args {
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep.pod
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Windows.

B<NOTE>: 2.0000 introduces Unicode support in the File back end. This
necessitates a change in the file format. The version 1.0003 format is
still supported, though, so we have added a L</db_version|db_version()>
still supported, though, so we have added a L<db_version|/db_version()>
method. If you are using a database in the old format, you will have to
upgrade it to get Unicode support.

Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Array.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Array;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Engine.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Engine;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Engine/DBI.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Engine::DBI;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
4 changes: 2 additions & 2 deletions lib/DBM/Deep/Engine/File.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Engine::File;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down Expand Up @@ -847,7 +847,7 @@ passed in and return the result.
sub _apply_digest {
my $self = shift;
my $victim = shift;
utf8::encode $victim if $self->{v} >= 4;
utf8::encode $victim if $self->{v} >= 4 and $] > 5.008003;
return $self->{digest}->($victim);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Hash.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Hash;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Iterator.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Iterator;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Iterator/File/BucketList.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Iterator::File::BucketList;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Iterator/File/Index.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Iterator::File::Index;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Null.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Null;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Sector.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Sector;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Sector/DBI.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Sector::DBI;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Sector/DBI/Reference.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Sector::DBI::Reference;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Sector/File.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Sector::File;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Sector/File/BucketList.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Sector::File::BucketList;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Sector/File/Data.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Sector::File::Data;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Sector/File/Null.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Sector::File::Null;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Sector/File/Reference.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Sector::File::Reference;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
4 changes: 2 additions & 2 deletions lib/DBM/Deep/Sector/File/Scalar.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Sector::File::Scalar;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down Expand Up @@ -44,7 +44,7 @@ sub _init {

my $data = delete $self->{data};
my $utf8 = do { no warnings 'utf8'; $data !~ /^[\0-\xff]*\z/ };
if($utf8){
if($utf8 and $] > 5.008003){
if($engine->{v} < 4) {
DBM::Deep->_throw_error(
"This database format version is too old for Unicode"
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Storage.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Storage;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Storage/DBI.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Storage::DBI;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
2 changes: 1 addition & 1 deletion lib/DBM/Deep/Storage/File.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DBM::Deep::Storage::File;

use 5.008_004;
use 5.006;

use strict;
use warnings FATAL => 'all';
Expand Down
4 changes: 3 additions & 1 deletion t/39_singletons.t
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ while ( my $dbm_maker = $dbm_factory->() ) {
is $w, undef,
'stale ref assignment warnings can be suppressed';
}

SKIP: {
skip "5.6", 2 if $] < 5.008004;
eval { $line = __LINE__+1;
() = $x->{stit};
};
Expand All @@ -83,6 +84,7 @@ while ( my $dbm_maker = $dbm_factory->() ) {
qr/^Can't use a stale reference as an ARRAY at \Q$file\E line(?x:
) $line\.?\n\z/,
'Using a stale reference as an array dies';
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion t/56_unicode.t
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ while ( my $dbm_maker = $dbm_factory->() ) {

SKIP: {
skip "This engine does not support Unicode", 1
unless $db->supports( 'unicode' );
if !$db->supports( 'unicode' ) or $] < 5.008004;

my $quote
= 'Ἐγένετο δὲ λόγῳ μὲν δημοκρατία, λόγῳ δὲ τοῦ πρώτου ἀνδρὸς ἀρχή.'
Expand Down
5 changes: 5 additions & 0 deletions t/97_dump_file.t
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Chains(I):
00000545: D 0064 foo
__END_DUMP__

SKIP: {
skip "5.6",1 if $] < 5.008004;

$db->{ḟoo} = 'bār';

is( $db->_dump_file, <<"__END_DUMP__", "Dump after Unicode assignment" );
Expand All @@ -50,4 +53,6 @@ Chains(I):
00000673: U 0064 ḟoo
__END_DUMP__

}

done_testing;