Ignore:
Timestamp:
2000-08-18T17:37:15+12:00 (24 years ago)
Author:
sjboddie
Message:

Added a -out option to most of the perl building scripts to allow output
debug information to be directed to a file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/BasPlug.pm

    r1411 r1424  
    3131use acronym;
    3232use textcat;
    33 use strict;
    3433use doc;
    3534use diagnostics;
     
    8584    my $self = {};
    8685    my $encodings = "^(iso_8859_1|Latin1|ascii|gb|iso_8859_6|windows_1256|Arabic|utf8|unicode)\$";
     86    $self->{'outhandle'} = STDERR;
    8787    my $year = (localtime)[5]+1900;
     88
    8889    # general options available to all plugins
    8990    if (!parsargv::parse(\@_,
     
    114115sub init {
    115116    my $self = shift (@_);
    116     my ($verbosity) = @_;
     117    my ($verbosity, $outhandle) = @_;
    117118
    118119    # verbosity is passed through from the processor
    119120    $self->{'verbosity'} = $verbosity;
     121
     122    # as is the outhandle ...
     123    $self->{'outhandle'} = $outhandle if defined $outhandle;
    120124
    121125    # set process_exp and block_exp to defaults unless they were
     
    209213
    210214    if ($text !~ /\w/) {
    211     print STDERR "$plugin_name: ERROR: $file contains no text\n" if $self->{'verbosity'};
     215    my $outhandle = $self->{'outhandle'};
     216    print $outhandle "$plugin_name: ERROR: $file contains no text\n" if $self->{'verbosity'};
    212217    return 0;
    213218    }
     
    387392
    388393# extract acronyms from a section in a document. progress is
    389 # reported to STDERR based on the verbosity. both the Acronym
     394# reported to outhandle based on the verbosity. both the Acronym
    390395# and the AcronymKWIC metadata items are created.
    391396
     
    393398    my $self = shift (@_);
    394399    my ($textref, $doc_obj, $thissection) = @_;
    395 
    396     print STDERR " extracting acronyms ...\n"
     400    my $outhandle = $self->{'outhandle'};
     401
     402    print $outhandle " extracting acronyms ...\n"
    397403    if ($self->{'verbosity'} >= 2);
    398404
     
    408414        {
    409415        $seen_before = "true";
    410         print STDERR "  already seen ". $acro->to_string() . "\n"
     416        print $outhandle "  already seen ". $acro->to_string() . "\n"
    411417            if ($self->{'verbosity'} >= 2);
    412418        }       
     
    420426        #do the normal acronym
    421427        $doc_obj->add_utf8_metadata($thissection, "Acronym",  $acro->to_string());
    422         print STDERR "  adding ". $acro->to_string() . "\n"
     428        print $outhandle "  adding ". $acro->to_string() . "\n"
    423429            if ($self->{'verbosity'} >= 1);
    424430       
     
    432438    }
    433439    }
    434     print STDERR " done extracting acronyms. \n"
     440    print $outhandle " done extracting acronyms. \n"
    435441    if ($self->{'verbosity'} >= 2);
    436442}
     
    439445    my $self = shift (@_);
    440446    my ($text, $doc_obj, $thissection) = @_;
    441 
    442     print STDERR " marking up acronyms ...\n"
     447    my $outhandle = $self->{'outhandle'};
     448
     449    print $outhandle " marking up acronyms ...\n"
    443450    if ($self->{'verbosity'} >= 2);
    444451
     
    446453    $text = &acronym::markup_acronyms($text, $self);
    447454
    448     print STDERR " done marking up acronyms. \n"
     455    print $outhandle " done marking up acronyms. \n"
    449456    if ($self->{'verbosity'} >= 2);
    450457
Note: See TracChangeset for help on using the changeset viewer.