Changeset 30344 for gs2-extensions


Ignore:
Timestamp:
2015-12-03T16:33:09+13:00 (8 years ago)
Author:
jmt12
Message:

Refined and completed driver - although I wonder if set_entry would be easy enough to support just by letting the same entry be written muptiple times... the last instance would clobber the others anyway

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/tdb/trunk/perllib/DBDrivers/GDBMTXTGZ.pm

    r30339 r30344  
    3333use FileUtils;
    3434# - OO inheritence
    35 use parent 'DBDrivers::GDBM';
     35use parent 'DBDrivers::70HyphenFormat';
    3636
    3737
     
    3939{
    4040    my $class = shift(@_);
    41     my $self = DBDrivers::GDBM->new();
     41    my $self = DBDrivers::70HyphenFormat->new(@_);
    4242    # Default TDB file extension
    4343    $self->{'default_file_extension'} = 'txt.gz';
     
    6060# Handled by 70HyphenFormat
    6161# sub close_infodb_write_handle(filehandle) => void
    62 # sub delete_infodb_entry(filehandle, string) => void
    6362# sub read_infodb_file(string, hashmap) => void
    6463# sub read_infodb_keys(string, hashmap) => void
     
    8786    my $opt_append = shift(@_);
    8887    my $infodb_file_handle;
    89     if (defined $opt_append) {
    90     my $output_operator = '>'; # clobber
    91     if ($opt_append eq "append") {
    92         $output_operator = '>>'; # append
    93     }
    94     $infodb_file_handle = $self->open_infodb_write_handle($infodb_file_path, $output_operator);
     88    # append
     89    if (defined $opt_append && $opt_append =~ /^-?append$/) {
     90    $infodb_file_handle = $self->SUPER::open_infodb_write_handle($infodb_file_path, '>>');
    9591    }
     92    # create or clobber
    9693    else {
    97     $infodb_file_handle = $self->open_infodb_write_handle($infodb_file_path);
     94    $infodb_file_handle = $self->SUPER::open_infodb_write_handle($infodb_file_path, '>');
    9895    }
    9996    return $infodb_file_handle;
     
    111108## set_infodb_entry(string, string, hashmap) => void ##
    112109
     110
    1131111;
Note: See TracChangeset for help on using the changeset viewer.