Changeset 22121 for main/trunk


Ignore:
Timestamp:
2010-05-19T17:55:59+12:00 (14 years ago)
Author:
max
Message:

Test added to insure that there is a valid string to convert into the hash table/database data structure (davidb)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/dbutil.pm

    r21856 r22121  
    316316{
    317317  my $infodb_entry_value = shift(@_);
    318 
    319318  my $infodb_map = ();
    320   while ($infodb_entry_value =~ /^<(.*?)>(.*)$/mg)
    321   {
    322     my $infodb_value_key = $1;
    323     my $infodb_value = $2;
    324 
    325     if (!defined($infodb_map->{$infodb_value_key}))
     319 
     320  if (!defined $infodb_entry_value) {
     321    print STDERR "Warning: No value to convert into a infodb hashtable\n";
     322  }
     323  else {
     324    while ($infodb_entry_value =~ /^<(.*?)>(.*)$/mg)
    326325    {
    327       $infodb_map->{$infodb_value_key} = [ $infodb_value ];
    328     }
    329     else
    330     {
    331       push(@{$infodb_map->{$infodb_value_key}}, $infodb_value);
    332     }
     326        my $infodb_value_key = $1;
     327        my $infodb_value = $2;
     328
     329        if (!defined($infodb_map->{$infodb_value_key}))
     330        {
     331          $infodb_map->{$infodb_value_key} = [ $infodb_value ];
     332        }
     333        else
     334        {
     335          push(@{$infodb_map->{$infodb_value_key}}, $infodb_value);
     336        }
     337    }
    333338  }
    334339
Note: See TracChangeset for help on using the changeset viewer.