Ignore:
Timestamp:
2008-02-22T11:32:38+13:00 (16 years ago)
Author:
davidb
Message:

In response to developing a custom plugin that stores metadata similar to MetadataXMLPlug, some functionality was shifted around so the custom plugin could also access it, and a couple of edits made so the two worked properly side by side.

File:
1 edited

Legend:

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

    r13492 r15004  
    112112}
    113113
     114
     115sub store_saved_metadata
     116{
     117    my ($plug,$mname,$mvalue,$md_accumulate) = @_;
     118
     119    if (defined $plug->{'saved_metadata'}->{$mname}) {
     120    if ($md_accumulate) {
     121        # accumulate mode - add value to existing value(s)
     122        if (ref ($plug->{'saved_metadata'}->{$mname}) eq "ARRAY") {
     123        push (@{$plug->{'saved_metadata'}->{$mname}}, $mvalue);
     124        } else {
     125        $plug->{'saved_metadata'}->{$mname} =
     126            [$plug->{'saved_metadata'}->{$mname}, $mvalue];
     127        }
     128    } else {
     129        # override mode
     130        $plug->{'saved_metadata'}->{$mname} = $mvalue;
     131    }
     132    } else {
     133    if ($md_accumulate) {
     134        # accumulate mode - add value into (currently empty) array
     135        $plug->{'saved_metadata'}->{$mname} = [$mvalue];
     136    } else {
     137        # override mode
     138        $plug->{'saved_metadata'}->{$mname} = $mvalue;
     139    }
     140    }
     141}
     142
     143
    1141441;
Note: See TracChangeset for help on using the changeset viewer.