1 package QsOutput; 2 3 use Env; 4 use POSIX; 5 use strict; 6 7 our($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); 8 9 my $Revision = substr(q$Revision: $,1); 10 my $ts = sub { strftime('%c',localtime()); }; 11 12 @ISA = qw(Exporter); 13 $VERSION = $Revision; 14 @EXPORT_OK = qw($DEBUGLVL); 15 @EXPORT = qw(debug); 16 17 our $DEBUGLVL = 0; 18 print $DEBUGLVL,"\n"; 19 20 1; 21 22 # debug {{{ 23 # prints debug messages 24 # returns(void) 25 26 sub debug 27 { 28 my $msg = shift; 29 my $pdbg = shift || 0; 30 my $dlvl = shift || 0; 31 32 print "DBG -- dlvl: $dlvl\n"; 33 if ( $dlvl >= $DEBUGLVL ) 34 { 35 if ( $pdbg ) 36 { 37 if ( $msg =~ /\n$/ ) 38 { 39 print &$ts ." : Debug($dlvl): $msg";