From: rkinyon Date: Wed, 22 Mar 2006 03:34:01 +0000 (+0000) Subject: Create a write_signature() method X-Git-Tag: 0-99_01~46 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0d0f3d5d8edab8fbf2f66eb5bd629adba48ba30d;p=dbsrgits%2FDBM-Deep.git Create a write_signature() method --- diff --git a/lib/DBM/Deep/Engine.pm b/lib/DBM/Deep/Engine.pm index 1b09bdc..e9cbcbb 100644 --- a/lib/DBM/Deep/Engine.pm +++ b/lib/DBM/Deep/Engine.pm @@ -102,6 +102,19 @@ sub new { return $self; } +sub write_file_signature { + my $self = shift; + my ($obj) = @_; + + my $fh = $obj->_fh; + + my $loc = $self->_request_space( $obj, length( SIG_FILE ) ); + seek($fh, $loc + $obj->_root->{file_offset}, SEEK_SET); + print( $fh SIG_FILE); + + return; +} + sub setup_fh { my $self = shift; my ($obj) = @_; @@ -120,9 +133,7 @@ sub setup_fh { # File is empty -- write signature and master index ## if (!$bytes_read) { - my $loc = $self->_request_space( $obj, length( SIG_FILE ) ); - seek($fh, $loc + $obj->_root->{file_offset}, SEEK_SET); - print( $fh SIG_FILE); + $self->write_file_signature( $obj ); $obj->{base_offset} = $self->_request_space( $obj, $self->tag_size( $self->{index_size} ),