NAME
Sys::OutPut -- Perl module to help make output easier.
SYNOPSIS
usage Sys::OutPut;
talk $fmtstr [, @args];
out $fmtstr [, @args];
put $fmtstr [, @args];
err $fmtstr [, @args];
debug $fmtstr [, @args];
$Sys::OutPut::quiet = $::quiet;
$Sys::OutPut::debug = $::debug;
DESCRIPTION
These subroutines will make generating output to STDOUT
and STDERR
easier.
All of the routines treat the $fmtstr argument as a printf format string, with @args as the format string arguments.
The talk routine generates output to STDERR
only if the variable $Sys::OutPut::quiet
is non-null and non-zero.
The out routine generates output to STDOUT
, with a newline appended to <$fmtstr>, if it is not already terminated with one.
The put routine generates output to STDOUT
, without any additional trailing newline.
The err routine generates output to STDERR
, with a newline appended if needed.
The debug routine generates output to STDERR
only if the variable $Sys::OutPut::debug
is non-null and non-zero, which is also returned as the result. This allows for convenient usages such as in the following example:
sub foo {
...
return if debug "Stopping now.";
...
next if debug "Skipping further processing";
...
}
If not defined by the user, the $Sys::OutPut::quiet
and $Sys::OutPut::debug
variables are initialized from their corresponding main variables $::quiet
and $::debug
, respectively, unless they are already defined.
AUTHOR
Alan K. Stebbens <aks@sgi.com>