-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.pl
executable file
·76 lines (65 loc) · 1.79 KB
/
debug.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#######################################################################
# debug.pl, ABr, 22MAR00
#
# Debug routines
#
# This code is copyrighted by Andy Bruce ("the author"). It is freely
# available for use in any application, but the source code must be
# released as-is. No warranty, either express or implied, is provided
# with this code. No implied warranty, nor implication of fitness for
# use or purpose, is provided with this code. This code is provided to
# the computing community in the hope that it will be useful. While the
# author is interested in hearing of defects or suggested improvements,
# the author makes no provision or promise to implement any suggestions
# or corrections.
package ABR ;
use strict ;
#######################################################################
# GLOBALS
# options
$ABR::gDEBUG = 0 ;
$ABR::gDEBUG_FIRST_TIME = 1 ;
$ABR::gVERBOSE = 0 ;
$ABR::gVERBOSE_FIRST_TIME = 1 ;
sub ABR::verboseprint {
if ( $ABR::gVERBOSE_FIRST_TIME) {
$ABR::gVERBOSE_FIRST_TIME = 0 ;
if (var_is_on("PERL_BLD_VERBOSE")) {
$ABR::gVERBOSE = 1;
}
}
return if( !$ABR::gVERBOSE ) ;
foreach my $i ( @_ ) {
print $i ;
} #foreach
} #verboseprint
sub ABR::debugprint {
if ( $ABR::gDEBUG_FIRST_TIME) {
$ABR::gDEBUG_FIRST_TIME = 0 ;
if (var_is_on("PERL_BLD_DEBUG")) {
$ABR::gDEBUG = 1;
}
}
return if( !$ABR::gDEBUG ) ;
foreach my $i ( @_ ) {
print $i ;
} #foreach
} #debugprint
sub var_is_on{
my ($arg) = @_ ;
# MKS on NT doesn't always use CAPS for env vars!!
my $env = $ENV{$arg} ;
if( !length( $env ) ) {
$arg = lc( $arg ) ;
$env = $ENV{$arg} ;
} #if
if( !length( $env ) ) {
$arg = uc( $arg ) ;
$env = $ENV{$arg} ;
} #if
if( $env =~ /Y/ ) {
return 1;
}
return 0;
} #var_is_on
1 ;