Changeset 85 for trunk/gsdl/perllib


Ignore:
Timestamp:
1998-12-21T15:12:32+13:00 (26 years ago)
Author:
rjmcnab
Message:

Fixed a few small bugs.

Location:
trunk/gsdl/perllib
Files:
2 edited

Legend:

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

    r74 r85  
    5353
    5454# returns the source_filename as it was provided
     55# the default of "indexed_doc" is used if no document
     56# type was provided
    5557sub get_doc_type {
    5658    my $self = shift (@_);
    5759
    58     return $self->get_metadata_element ($self->get_top_section(), "gsdldoctype");
     60    my $doc_type = $self->get_metadata_element ($self->get_top_section(), "gsdldoctype");
     61    return $doc_type if (defined $doc_type);
     62    return "indexed_doc";
     63}
     64
     65sub _escape_text {
     66    my ($text) = @_;
     67
     68    # special characters in the gml encoding
     69    $text =~ s/&/&/g; # this has to be first...
     70    $text =~ s/</&lt;/g;
     71    $text =~ s/>/&gt;/g;
     72    $text =~ s/\"/&quot;/g;
     73
     74    return $text;
    5975}
    6076
     
    7591    print $handle " gsdlnum=\"$section_num\"" if defined $section_num;
    7692    foreach $data (@{$section_ptr->{'metadata'}}) {
    77     print $handle " $data->[0]=\"$data->[1]\""
     93    print $handle " $data->[0]=\"" . &_escape_text($data->[1]) . "\""
    7894        unless $suppress_subject_info && $data->[0] eq "Subject";
    7995    }
     
    8197
    8298    # output the text
    83     print $handle $section_ptr->{'text'};
     99    print $handle &_escape_text($section_ptr->{'text'});
    84100
    85101    # output all the subsections
     
    166182sub get_OID {
    167183    my $self = shift (@_);
    168    
    169     return $self->get_metadata_element ($self->get_top_section(), "Identifier");
     184    my $OID = $self->get_metadata_element ($self->get_top_section(), "Identifier");
     185    return $OID if (defined $OID);
     186    return "NULL";
    170187}
    171188
  • trunk/gsdl/perllib/mgbuilder.pm

    r81 r85  
    269269    my $indexexparr = [];
    270270    my ($level, $fields, $subcollection) = split (":", $index);
    271     my (@subcollections) = split /,/, $subcollection;
     271    my @subcollections = ();
     272    @subcollections = split /,/, $subcollection if (defined $subcollection);
    272273
    273274    foreach $subcollection (@subcollections) {
     
    359360    &util::mk_all_dir ($textdir);
    360361
    361     # assume little-endian for now :-)
    362     my $fulldbname = &util::filename_cat ($textdir, "$self->{'collection'}.ldb");
     362    # get db name
     363    my $dbext = ".bdb";
     364    $dbext = ".ldb" if &util::is_little_endian();
     365    my $fulldbname = &util::filename_cat ($textdir, "$self->{'collection'}$dbext");
    363366    $fulldbname =~ s/\//\\/g if ($ENV{'GSDLOS'} =~ /^windows$/i);
     367
    364368    my $exedir = "$ENV{'GSDLHOME'}/bin/$ENV{'GSDLOS'}";
    365369    my $exe = &util::get_os_exe ();
Note: See TracChangeset for help on using the changeset viewer.