diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2004-02-02 19:56:50 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2004-02-02 19:56:50 +0000 |
commit | de2c5c0a1e612080d618ce13a044e5d9411fb484 (patch) | |
tree | bbb831a5c476de12ee023111d256c2cfec2f5e3f /modules/OutputMessage.pm | |
parent | 439e6af664cc306c10defc5f87ca55ee190019d4 (diff) | |
download | MPC-de2c5c0a1e612080d618ce13a044e5d9411fb484.tar.gz |
ChangeLogTag: Mon Feb 2 13:53:08 2004 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/OutputMessage.pm')
-rw-r--r-- | modules/OutputMessage.pm | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/modules/OutputMessage.pm b/modules/OutputMessage.pm new file mode 100644 index 00000000..f418b9a0 --- /dev/null +++ b/modules/OutputMessage.pm @@ -0,0 +1,79 @@ +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($self) = bless {'information' => $info, + 'warnings' => $warn, + }, $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 information { + my($self) = shift; + my($msg) = shift; + + if ($self->{'information'}) { + print $information . $self->split_message($msg, ' ' x + length($information)); + } +} + + +sub warning { + my($self) = shift; + my($msg) = shift; + + if ($self->{'warnings'}) { + print $warning . $self->split_message($msg, ' ' x + length($warning)); + } +} + + +sub error { + my($self) = shift; + my($msg) = shift; + + print $error . $self->split_message($msg, ' ' x + length($error)); +} + + +1; |