- Timestamp:
- 2015-12-16T10:41:27+13:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/tdb/trunk/perllib/DBDrivers/70HyphenFormat.pm
r30347 r30348 88 88 } 89 89 ## close_infodb_write_handle(filehandle) => void ## 90 91 92 ## @function convert_infodb_hash_to_string(hashmap) => string93 #94 sub convert_infodb_hash_to_string95 {96 my $self = shift(@_);97 my $infodb_map = shift(@_);98 my $infodb_entry_value = "";99 foreach my $infodb_value_key (keys(%$infodb_map)) {100 foreach my $infodb_value (@{$infodb_map->{$infodb_value_key}}) {101 $infodb_entry_value .= "<$infodb_value_key>" . $infodb_value . "\n";102 }103 }104 return $infodb_entry_value;105 }106 ## convert_infodb_hash_to_string(hashmap) => string ##107 108 109 ## @function convert_infodb_string_to_hash(string) => hashmap110 #111 sub convert_infodb_string_to_hash112 {113 my $self = shift(@_);114 my $infodb_entry_value = shift(@_);115 my $infodb_map = ();116 117 if (!defined $infodb_entry_value) {118 print STDERR "Warning: No value to convert into a infodb hashtable\n";119 }120 else {121 while ($infodb_entry_value =~ /^<(.*?)>(.*)$/mg) {122 my $infodb_value_key = $1;123 my $infodb_value = $2;124 125 if (!defined($infodb_map->{$infodb_value_key})) {126 $infodb_map->{$infodb_value_key} = [ $infodb_value ];127 }128 else {129 push(@{$infodb_map->{$infodb_value_key}}, $infodb_value);130 }131 }132 }133 134 return $infodb_map;135 }136 ## convert_infodb_string_to_hash(string) => hashmap ##137 90 138 91
Note:
See TracChangeset
for help on using the changeset viewer.