OutPut.pm -- Perl module to help make output easier.
talk $fmtstr [, @args]; out $fmtstr [, @args]; put $fmtstr [, @args]; err $fmtstr [, @args]; debug $fmtstr [, @args]; $Sys::OutPut::quiet = $::quiet; $Sys::OutPut::debug = $::debug;
These subroutines will make generating output to STDOUT and STDERR easier.
STDOUT
STDERR
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.
$Sys::OutPut::quiet
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:
$Sys::OutPut::debug
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.
$::quiet
$::debug
Alan K. Stebbens <aks@hub.ucsb.edu>
To install Sys::OutPut, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sys::OutPut
CPAN shell
perl -MCPAN -e shell install Sys::OutPut
For more information on module installation, please visit the detailed CPAN module installation guide.