Changeset 1374

Show
Ignore:
Timestamp:
08.08.2000 16:36:49 (19 years ago)
Author:
sjboddie
Message:

made set_OID use original document text instead of document object

Files:
1 modified

Legend:

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

    r1241 r1374  
    4343sub new { 
    4444    my $class = shift (@_); 
    45      
     45    my ($source_filename, $doc_type) = @_; 
     46 
    4647    my $self = bless {'associated_files'=>[], 
    4748              'subsection_order'=>[], 
     
    5152              'text'=>""}, $class; 
    5253 
    53 #    $self->set_source_filename ($source_filename) if defined $source_filename; 
    54     push (@{$self->{'metadata'}}, ["gsdlsourcefilename", $source_filename]) if defined $source_filename; 
    55 #    $self->set_doc_type ($doc_type) if defined $doc_type; 
    56     push (@{$self->{'metadata'}}, ["gsdldoctype", $doc_type]) if defined $doc_type; 
     54    $self->set_source_filename ($source_filename) if defined $source_filename; 
     55    $self->set_doc_type ($doc_type) if defined $doc_type; 
    5756 
    5857    return $self; 
     
    246245    if (!defined $OID) { 
    247246    $OID = "NULL"; 
    248     my $tmp_filename = &util::get_tmp_filename(); 
    249     if (!open (OUTFILE, ">$tmp_filename")) { 
    250         print STDERR "doc::set_OID could not write to $tmp_filename\n"; 
     247 
     248    my $filename = $self->get_source_filename(); 
     249    if (defined ($filename)) { 
     250 
     251        $OID = $self->_calc_OID ($filename); 
     252 
    251253    } else { 
    252         $self->output_section('OUTFILE', $self->get_top_section(), 1); 
    253         close (OUTFILE); 
    254  
    255         $OID = $self->_calc_OID ($tmp_filename); 
     254         
     255        print STDERR "doc::set_OID WARNING source filename undefined (continuing)\n"; 
     256         
     257        $filename = &util::get_tmp_filename(); 
     258        if (!open (OUTFILE, ">$tmp_filename")) { 
     259        print STDERR "doc::set_OID could not write to $tmp_filename\n"; 
     260        } else { 
     261        $self->output_section('OUTFILE', $self->get_top_section(), 1); 
     262        close (OUTFILE); 
     263        } 
     264         
     265        $OID = $self->_calc_OID ($filename); 
    256266        &util::rm ($tmp_filename); 
    257267    }