Changeset 28000


Ignore:
Timestamp:
2013-08-08T12:07:37+12:00 (8 years ago)
Author:
jmt12
Message:

Functions for determining if the plugout supports writing Datestamp and RSS information internally (or if Greenstone should handle writing them itself)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/tdb-edit/trunk/src/perllib/dbutil.pm

    r27400 r28000  
    9595
    9696
     97## @function test_dynamic_driver_function()
     98#
     99# Checks to see if a function in a dynamically loaded driver exists
     100#
     101sub test_dynamic_driver_function
     102{
     103  my $function_name = shift(@_);
     104  my $driver_name = shift(@_);
     105  my $package_name = 'dbutil::' . $driver_name;
     106  # - try to load the requested infodb type
     107  if (!&load_db_driver($package_name))
     108  {
     109    # - try loading the default GDBM driver
     110    print STDERR 'Warning! Using default database driver (GDBM) as failed to load configured database driver: ' . $driver_name . "\n";
     111    $package_name = 'dbutil::gdbm';
     112    if (!&load_db_driver($package_name))
     113    {
     114      die("Fatal Error! Failed to load default database driver: dbutil::gdbm\n");
     115    }
     116  }
     117  # - make call to the newly created package
     118  no strict;
     119  # - lets check that the function we are about to call
     120  my $symbol = qualify($function_name, $package_name);
     121  return defined &{$symbol};
     122}
     123## test_dynamic_driver_function() ##
     124
     125
     126## @function
     127#
    97128sub open_infodb_write_handle
    98129{
     
    170201    return &dbutil::call_dynamic_driver_function('read_infodb_keys', $infodb_type, $infodb_file_path, $infodb_map, @_);
    171202}
     203
     204
     205## @function supportDatestamp
     206#
     207sub supportsDatestamp
     208{
     209  my $infodb_type = shift(@_);
     210  return &dbutil::test_dynamic_driver_function('supportsDatestamp', $infodb_type);
     211}
     212## supportsDatestamp() ##
     213
     214
     215## @function supportRSS
     216#
     217sub supportsRSS
     218{
     219  my $infodb_type = shift(@_);
     220  return &dbutil::test_dynamic_driver_function('supportsRSS', $infodb_type);
     221}
     222## supportsRSS() ##
     223
    172224
    173225sub write_infodb_entry
Note: See TracChangeset for help on using the changeset viewer.