Changeset 15711

Show
Ignore:
Timestamp:
27.05.2008 12:17:05 (11 years ago)
Author:
mdewsnip
Message:

(Adding new DB support) Creating a new "open_infodb_write_handle()" function in dbutil.pm to remove the last bit of GDBM-specific code from basebuilder.pm.

Location:
gsdl/trunk/perllib
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/basebuilder.pm

    r15710 r15711  
    342342    } 
    343343    else { 
    344     my $exedir = "$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}"; 
    345     my $exe = &util::get_os_exe (); 
    346     my $txt2db_exe = &util::filename_cat($exedir, "txt2db$exe"); 
    347  
    348     if (!-e "$txt2db_exe" || !open (PIPEOUT, "| txt2db$exe \"$infodb_file_path\"")) { 
     344    $infodb_handle = &dbutil::open_infodb_write_handle($infodb_file_path); 
     345    if (!defined($infodb_handle)) 
     346    { 
    349347        print STDERR "<FatalError name='NoRunText2DB'/>\n</Stage>\n" if $self->{'gli'}; 
    350         die "builder::make_infodatabase - couldn't run $txt2db_exe\n"; 
    351     } 
    352     $infodb_handle = *PIPEOUT; 
     348        die "builder::make_infodatabase - couldn't open infodb write handle\n"; 
     349    } 
    353350    } 
    354351     
  • gsdl/trunk/perllib/dbutil.pm

    r15710 r15711  
    3838 
    3939 
     40sub open_infodb_write_handle 
     41{ 
     42    my $infodb_file_path = shift(@_); 
     43 
     44    return &open_infodb_write_handle_gdbm($infodb_file_path); 
     45} 
     46 
     47 
    4048sub read_infodb_file 
    4149{ 
     
    7078    my $infodb_file_name = &util::get_dirsep_tail($collection_name) . $infodb_file_extension; 
    7179    return &util::filename_cat($infodb_directory_path, $infodb_file_name); 
     80} 
     81 
     82 
     83sub open_infodb_write_handle_gdbm 
     84{ 
     85    my $infodb_file_path = shift(@_); 
     86 
     87    my $txt2db_exe = &util::filename_cat("$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}", "txt2db" . &util::get_os_exe()); 
     88    if (!-e "$txt2db_exe" || !open(PIPEOUT, "| $txt2db_exe \"$infodb_file_path\"")) 
     89    { 
     90    return undef; 
     91    } 
     92 
     93    return *PIPEOUT; 
    7294} 
    7395