1 package DBM::Deep::File;
8 use Fcntl qw( :DEFAULT :flock :seek );
10 our $VERSION = '0.01';
25 filter_store_key => undef,
26 filter_store_value => undef,
27 filter_fetch_key => undef,
28 filter_fetch_value => undef,
33 # Grab the parameters we want to use
34 foreach my $param ( keys %$self ) {
35 next unless exists $args->{$param};
36 $self->{$param} = $args->{$param};
39 if ( $self->{fh} && !$self->{file_offset} ) {
40 $self->{file_offset} = tell( $self->{fh} );
43 $self->open unless $self->{fh};
51 # Adding O_BINARY does remove the need for the binmode below. However,
52 # I'm not going to remove it because I don't have the Win32 chops to be
53 # absolutely certain everything will be ok.
54 my $flags = O_RDWR | O_CREAT | O_BINARY;
57 sysopen( $fh, $self->{file}, $flags )
58 or die "DBM::Deep: Cannot sysopen file '$self->{file}': $!\n";
61 # Even though we use O_BINARY, better be safe than sorry.
64 if ($self->{autoflush}) {
93 sub begin_transaction {
96 $self->{transaction_id}++;
102 $self->{transaction_id} = 0;
108 return $self->{transaction_id};