Ignore:
Timestamp:
2003-12-03T12:02:55+13:00 (20 years ago)
Author:
jmt12
Message:

Changed the description for the -metadata flag to foreshadow the coming enhancement. This commit also happens to include the prototype -ignore_arguments flag to AZList, that will never actually be used because of the aforementioned metadata enhancement.

File:
1 edited

Legend:

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

    r3834 r6111  
    608608
    609609# returns the first metadata value which matches field
     610
     611# This version of get metadata element works much like the one above,
     612# except it allows for the namespace portion of a metadata element to
     613# be ignored, thus if you are searching for dc.Title, the first piece
     614# of matching metadata ending with the name Title (once any namespace
     615# is removed) would be returned.
     616# 28-11-2003 John Thompson
    610617sub get_metadata_element {
    611618    my $self = shift (@_);
    612     my ($section, $field) = @_;
     619    my ($section, $field, $ignore_namespace) = @_;
    613620    my ($data);
     621
     622    $ignore_namespace = 0 unless defined $ignore_namespace;
    614623
    615624    my $section_ptr = $self->_lookup_section($section);
     
    620629    }
    621630
     631    # Remove the any namespace if we are being told to ignore them
     632    if($ignore_namespace) {
     633    $field =~ s/^\w*\.//;
     634    }
     635
    622636    foreach $data (@{$section_ptr->{'metadata'}}) {
    623     return $data->[1] if (scalar(@$data) >= 2 && $data->[0] eq $field);
     637
     638    my $data_name = $data->[0];
     639    # Remove the any namespace if we are being told to ignore them
     640    if($ignore_namespace) {
     641        $data_name =~ s/^\w*\.//;
     642    }
     643   
     644    return $data->[1] if (scalar(@$data) >= 2 && $data_name eq $field);
    624645    }
    625646   
     
    627648}
    628649
    629 
    630650# returns a list of the form [value1, value2, ...]
    631651sub get_metadata {
    632652    my $self = shift (@_);
    633     my ($section, $field) = @_;
     653    my ($section, $field, $ignore_namespace) = @_;
    634654    my ($data);
     655
     656    $ignore_namespace = 0 unless defined $ignore_namespace;
    635657
    636658    my $section_ptr = $self->_lookup_section($section);
     
    641663    }
    642664
     665    # Remove the any namespace if we are being told to ignore them
     666    if($ignore_namespace) {
     667    $field =~ s/^\w*\.//;
     668    }
     669
    643670    my @metadata = ();
    644671    foreach $data (@{$section_ptr->{'metadata'}}) {
    645         push (@metadata, $data->[1]) if ($data->[0] eq $field);
     672
     673    my $data_name = $data->[0];
     674    # Remove the any namespace if we are being told to ignore them
     675    if($ignore_namespace) {
     676        $data_name =~ s/^\w*\.//;
     677    }
     678
     679        push (@metadata, $data->[1]) if ($data_name eq $field);
    646680    }
    647681       
Note: See TracChangeset for help on using the changeset viewer.