Changeset 32590

Show
Ignore:
Timestamp:
09.11.2018 18:48:50 (5 weeks ago)
Author:
ak19
Message:

Adding a add_utf8_textref() method to allow fulltxt to be passed by ref to it. Used by GreenstoneSQLPlugin.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/doc.pm

    r32535 r32590  
    12121212# been converted to the UTF-8 encoding. For ascii text use 
    12131213# add_text 
     1214# Pass by value version (internally calls pass by ref version 
     1215# to avoid code duplication) 
    12141216sub add_utf8_text { 
    12151217    my $self = shift (@_); 
    12161218    my ($section, $text) = @_; 
     1219     
     1220    $self->add_utf8_textref($section, \$text); 
     1221} 
     1222 
     1223# Pass by reference version, used by GreenstoneSQLPlugin for fulltext 
     1224sub add_utf8_textref { 
     1225    my $self = shift (@_); 
     1226    my ($section, $text_ref) = @_; 
    12171227 
    12181228    my $section_ptr = $self->_lookup_section($section); 
    12191229    if (!defined $section_ptr) { 
    1220     print STDERR "doc::add_utf8_text couldn't find section " . 
     1230    print STDERR "doc::add_utf8_textref couldn't find section " . 
    12211231        "$section\n"; 
    12221232    return; 
    12231233    } 
    12241234 
    1225     $section_ptr->{'text'} .= $text; 
     1235    $section_ptr->{'text'} .= $$text_ref; 
    12261236} 
    12271237