package OutputTool; use strict; 1; # This package provides functions to output search results from Webglimpse # Any replacement Output object must implement all of the following functions # and provide the fields defined in _initialize sub new { my $class = shift; my $self = {}; bless $self, $class; $self->_initialize(); return $self; } # Set any static fields we will need later sub _initialize { my $self = shift; $self->{end_file_marker} = "\n"; } sub makeInitialOutput { my $self = shift; my($pquery, $title, $QS_file, $QS_lines) = @_; my($initial_output) = ''; $initial_output .= "Result for query \"$pquery\"\n"; $initial_output .= "\n"; $initial_output .= "
"; $initial_output .= "

Results for query \"$pquery\"

\n"; $initial_output .= "

on: $title

\n"; if ($QS_file) { $initial_output .= "Search on neighborhood of $title\n"; $initial_output .= "

\n"; } else { $initial_output .= "Search on entire archive\n"; $initial_output .= "

\n"; } if($QS_lines){ $initial_output .= "File name (modification date), and list of matched lines (preceded by line numbers)
\n"; }else{ $initial_output .= "File name (modification date), and list of matched lines
\n"; } return $initial_output; } sub limitMaxLines { my $self = shift; my($maxlines) = @_; return "

  • Limit of $maxlines matched lines per file exceeded...\n"; } sub limitMaxFiles { my $self = shift; my($maxfiles) = @_; print $self->{end_file_marker}; print "

    Limit of $maxfiles files exceeded. Check the search options.

    \n"; } sub makeEndHits { my $self = shift; return "
    "; } sub makeLinkOutput { my $self = shift; my($link, $title, $date) = @_; my $retstring = "
    "; $retstring .= $title.", $date
    \n