use strict;
use warnings FATAL => 'all';
+no warnings 'recursion';
our $VERSION = q(1.0014);
use strict;
use warnings;
+no warnings 'recursion';
our $VERSION = q(1.0013);
use strict;
use warnings FATAL => 'all';
+no warnings 'recursion';
# Never import symbols into our namespace. We are a class, not a library.
# -RobK, 2008-05-27
use strict;
use warnings FATAL => 'all';
+no warnings 'recursion';
use base qw( DBM::Deep::Engine::Sector::Data );
use strict;
use warnings FATAL => 'all';
+no warnings 'recursion';
use base 'DBM::Deep';
# DBM::Deep Test
##
use strict;
-use Test::More tests => 49;
+use Test::More tests => 51;
use Test::Exception;
use t::common qw( new_fh );
,"keys() still works if you replace long values with shorter ones"
);
+# Make sure we do not trigger a deep recursion warning [RT #53575]
+{
+ my $w;
+ local $SIG{__WARN__} = sub { $w = shift };
+ my ($fh, $filename) = new_fh();
+ my $db = DBM::Deep->new( file => $filename, fh => $fh, );
+ my $h = {};
+ my $tmp = $h;
+ for(1..100) {
+ %$tmp = ("" => {});
+ $tmp = $$tmp{""};
+ }
+ ok eval {
+ $db->{""} = $h;
+ }, 'deep recursion in hash assignment' or diag $@;
+ is $w, undef, 'no warnings with deep recursion in hash assignment';
+}
+
# Test autovivification
$db->{unknown}{bar} = 1;
ok( $db->{unknown}, 'Autovivified hash exists' );
# DBM::Deep Test
##
use strict;
-use Test::More tests => 128;
+use Test::More tests => 130;
use Test::Exception;
use t::common qw( new_fh );
is( $db->[4][3][1], 2, "Right arrayref there" );
is( $db->[5]{foo}, 1, "Right hashref there" );
}
+
+{ # Make sure we do not trigger a deep recursion warning [RT #53575]
+ my $w;
+ local $SIG{__WARN__} = sub { $w = shift };
+ my ($fh, $filename) = new_fh();
+ my $db = DBM::Deep->new( file => $filename, fh => $fh, );
+ my $a = [];
+ my $tmp = $a;
+ for(1..100) {
+ ($tmp) = @$tmp = [];
+ }
+ ok eval {
+ $db->{""} = $a;
+ }, 'deep recursion in array assignment' or diag $@;
+ is $w, undef, 'no warnings with deep recursion in array assignment';
+}
##
# large keys
##
-my $val1 = "a" x 1000;
+my $val1 = "a" x 6000;
$db->{foo} = $val1;
-is( $db->{foo}, $val1, "1000 char value stored and retrieved" );
+is( $db->{foo}, $val1, "6000 char value stored and retrieved" );
delete $db->{foo};
my $size = -s $filename;