$self->open( $obj ) if !defined $obj->_fh;
my $fh = $obj->_fh;
+ print "1\n";
flock $fh, LOCK_EX;
+ print "2\n";
unless ( $obj->{base_offset} ) {
seek($fh, 0 + $obj->_root->{file_offset}, SEEK_SET);
use strict;
use Test::More tests => 3;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
diag "Testing DBM::Deep against Perl $] located at $^X";
# basic file open
##
my $dir = tempdir( CLEANUP => 1 );
-my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
-my $db = eval { DBM::Deep->new( $filename ) };
+my ($fh, $filename) = tempfile( 'tmpXXXX', DIR => $dir );
+flock $fh, LOCK_UN;
+my $db = eval {
+ local $SIG{__DIE__};
+ DBM::Deep->new( $filename );
+};
if ( $@ ) {
diag "ERROR: $@";
Test::More->builder->BAIL_OUT( "Opening a new file fails" );
use Test::More tests => 30;
use Test::Exception;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new( $filename );
##
use strict;
use Test::More tests => 2;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new(
file => $filename,
type => DBM::Deep->TYPE_HASH
use Test::More tests => 107;
use Test::Exception;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new(
file => $filename,
type => DBM::Deep->TYPE_ARRAY
use strict;
use Test::More tests => 2;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new(
file => $filename,
type => DBM::Deep->TYPE_ARRAY
use Test::More tests => 6;
use Test::Exception;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
##
# test a corrupted file
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my %hash;
tie %hash, 'DBM::Deep', $filename;
undef %hash;
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my @array;
tie @array, 'DBM::Deep', $filename;
undef @array;
use strict;
use Test::More tests => 4;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new(
file => $filename,
locking => 1,
use strict;
use Test::More tests => 5;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $max_levels = 1000;
use strict;
use Test::More tests => 3;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $max_levels = 1000;
use strict;
use Test::More tests => 14;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new(
file => $filename,
);
use strict;
use Test::More tests => 14;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
{
my $clone;
use strict;
use Test::More tests => 2;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my $db = DBM::Deep->new(
file => $filename,
autoflush => 1
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my $db = DBM::Deep->new(
file => $filename,
autoflush => 1
use strict;
use Test::More tests => 17;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new(
file => $filename,
);
use strict;
use Test::More tests => 14;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $salt = 38473827;
use strict;
use Test::More tests => 32;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new( $filename );
##
use strict;
use Test::More tests => 2;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new( $filename );
##
use strict;
use Test::More tests => 2;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $struct;
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my $db = DBM::Deep->new( $filename );
##
use strict;
use Test::More tests => 5;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh2, $filename2) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh2, LOCK_UN;
my $db2 = DBM::Deep->new( $filename2 );
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my $db = DBM::Deep->new( $filename );
##
use Test::More tests => 11;
use Test::Exception;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
##
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my %hash;
my $db = tie %hash, 'DBM::Deep', $filename;
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my %hash;
my $db = tie %hash, 'DBM::Deep', {
file => $filename,
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my @array;
my $db = tie @array, 'DBM::Deep', $filename;
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my @array;
my $db = tie @array, 'DBM::Deep', {
file => $filename,
}
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
throws_ok {
tie my %hash, 'DBM::Deep', [ file => $filename ];
} qr/Not a hashref/, "Passing an arrayref to TIEHASH fails";
use Test::More tests => 7;
use Test::Exception;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir();
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
{
my %hash;
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
DBM::Deep->new( file => $filename, type => DBM::Deep->TYPE_ARRAY );
throws_ok {
use strict;
use Test::More tests => 13;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new( $filename );
##
my $max_keys = 1000;
my ($fh2, $filename2) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh2, LOCK_UN;
{
my $db = DBM::Deep->new( $filename2 );
use Test::More tests => 7;
use Test::Exception;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new( $filename );
$db->{key1} = "value1";
use Test::More tests => 64;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
{
my $db = DBM::Deep->new(
file => $filename,
}
my ($fh2, $filename2) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh2, LOCK_UN;
{
my $db = DBM::Deep->new(
file => $filename2,
# content after that point in file to check for corruption.
##
my ($fh3, $filename3) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh3, LOCK_UN;
my $db = DBM::Deep->new(
file => $filename3,
autobless => 1,
use Test::More tests => 5;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my %hash;
my $obj = tie %hash, 'DBM::Deep', $filename;
{
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+ flock $fh, LOCK_UN;
my @array;
my $obj = tie @array, 'DBM::Deep', $filename;
use Test::More tests => 10;
use Test::Exception;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
my $x = 25;
{
use Test::More tests => 11;
use Test::Exception;
use File::Temp qw( tempfile tempdir );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my $dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1, DIR => $dir );
+flock $fh, LOCK_UN;
# Create the datafile to be used
{
use Test::More tests => 3;
use File::Temp qw( tempfile );
+use Fcntl qw( :flock );
use_ok( 'DBM::Deep' );
my ($fh, $filename) = tempfile( 'tmpXXXX', UNLINK => 1 );
+flock $fh, LOCK_UN;
my $db = DBM::Deep->new({
file => $filename,
autoflush => 1,