<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package OutputMessage;

# ************************************************************
# Description   : Prints information, warnings and errors.
# Author        : Chad Elliott
# Create Date   : 2/02/2004
# ************************************************************

# ************************************************************
# Pragmas
# ************************************************************

use strict;

# ************************************************************
# Data Section
# ************************************************************

my($information) = 'INFORMATION: ';
my($warning)     = 'WARNING: ';
my($error)       = 'ERROR: ';

# ************************************************************
# Subroutine Section
# ************************************************************

sub new {
  my($class) = shift;
  my($info)  = shift;
  my($warn)  = shift;
  my($diag)  = shift;
  my($self)  = bless {'information' =&gt; $info,
                      'warnings'    =&gt; $warn,
                      'diagnostic'  =&gt; $diag,
                     }, $class;
  return $self;
}


sub split_message {
  my($self) = shift;
  my($msg)  = shift;
  my($spc)  = shift;

  $msg =~ s/\.\s+/.\n$spc/g;
  return $msg . "\n";
}


sub diagnostic {
  my($self) = shift;
  my($msg)  = shift;

  if ($self-&gt;{'diagnostic'}) {
    print "$msg\n";
  }
}


sub information {
  my($self) = shift;
  my($msg)  = shift;

  if ($self-&gt;{'information'}) {
    print $information . $self-&gt;split_message($msg, ' ' x
                                              length($information));
  }
}


sub warning {
  my($self) = shift;
  my($msg)  = shift;

  if ($self-&gt;{'warnings'}) {
    print $warning . $self-&gt;split_message($msg, ' ' x
                                          length($warning));
  }
}


sub error {
  my($self) = shift;
  my($msg)  = shift;
  my($pre)  = shift;

  if (defined $pre) {
    print STDERR "$pre\n";
  }
  print STDERR $error . $self-&gt;split_message($msg, ' ' x
                                             length($error));
}


1;
</pre></body></html>