Changeset 16924

Show
Ignore:
Timestamp:
20.08.2008 18:35:52 (11 years ago)
Author:
ak19
Message:

Added subroutine assocfile_from_sourcefile which works out the name of the associated file from the SourceFile? metadata (which is the url ref to the associated file as it is name d on the filesystem).

Files:
1 modified

Legend:

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

    r16792 r16924  
    932932} 
    933933 
     934# get the actual name of the assocfile from SourceFile which is the url referring to it  
     935sub assocfile_from_sourcefile { 
     936    my $self = shift (@_); 
     937     
     938    # get the SourceFile meta, which is a *URL* to a file on the filesystem 
     939    my $top_section = $self->get_top_section(); 
     940    my $source_file = $self->get_metadata_element($top_section, "SourceFile"); 
     941 
     942    # get the actual filename as it exists on the filesystem which this url refers to 
     943    $source_file = &unicode::url_to_filename($sourcefile);  
     944    my ($assocfilename) = $source_file =~ /([^\\\/]+)$/; 
     945    return $assocfilename; 
     946} 
     947 
    934948 
    935949# methods for dealing with associated files