| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CIPP::Debug; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
32
|
|
|
4
|
1
|
|
|
1
|
|
73551
|
use Data::Dumper; |
|
|
1
|
|
|
|
|
34045
|
|
|
|
1
|
|
|
|
|
709
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
|
7
|
|
|
|
|
|
|
# Debugging stuff |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# Setzen/Abfragen des Debugging Levels. Wenn als Klassenmethode |
|
10
|
|
|
|
|
|
|
# aufgerufen, wird das Debugging klassenweit eingeschaltet. Als |
|
11
|
|
|
|
|
|
|
# Objektmethode aufgerufen, wird Debugging nur für das entsprechende |
|
12
|
|
|
|
|
|
|
# Objekt eingeschaltet. |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# Level: 0 Debugging deaktiviert |
|
15
|
|
|
|
|
|
|
# 1 nur aktive Debugging Ausgaben |
|
16
|
|
|
|
|
|
|
# 2 Call Trace, Subroutinen Namen |
|
17
|
|
|
|
|
|
|
# 3 Call Trace, Subroutinen Namen + Argumente |
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
# Debuggingausgaben erfolgen im Klartext auf STDERR. |
|
20
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub debug_level { |
|
23
|
0
|
|
|
0
|
0
|
|
my $thing = shift; |
|
24
|
0
|
|
|
|
|
|
my $debug; |
|
25
|
0
|
0
|
|
|
|
|
if ( ref $thing ) { |
|
26
|
0
|
0
|
|
|
|
|
$thing->{debug} = shift if @_; |
|
27
|
0
|
|
|
|
|
|
$debug = $thing->{debug}; |
|
28
|
|
|
|
|
|
|
} else { |
|
29
|
0
|
0
|
|
|
|
|
$CIPP::DEBUG = shift if @_; |
|
30
|
0
|
|
|
|
|
|
$debug = $CIPP::DEBUG; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if ( $debug ) { |
|
34
|
0
|
|
|
|
|
|
$CIPP::DEBUG::TIME = scalar(localtime(time)); |
|
35
|
0
|
|
|
|
|
|
print STDERR |
|
36
|
|
|
|
|
|
|
"--- START ------------------------------------\n", |
|
37
|
|
|
|
|
|
|
"$$: $CIPP::DEBUG::TIME - DEBUG LEVEL $debug\n"; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return $debug; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
|
44
|
|
|
|
|
|
|
# Klassen/Objekt Methode |
|
45
|
|
|
|
|
|
|
# |
|
46
|
|
|
|
|
|
|
# Gibt je nach Debugginglevel entsprechende Call Trace Informationen |
|
47
|
|
|
|
|
|
|
# aus bzw. tut gar nichts, wenn Debugging abgeschaltet ist. |
|
48
|
|
|
|
|
|
|
#--------------------------------------------------------------------- |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub trace_in { |
|
51
|
0
|
|
|
0
|
0
|
|
my $thing = shift; |
|
52
|
0
|
|
|
|
|
|
my $debug = $CIPP::DEBUG; |
|
53
|
0
|
0
|
0
|
|
|
|
$debug = $thing->{debug} if ref $thing and $thing->{debug}; |
|
54
|
0
|
0
|
|
|
|
|
return if $debug < 2; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# Level 1: Methodenaufrufe |
|
57
|
0
|
0
|
|
|
|
|
if ( $debug == 2 ) { |
|
58
|
0
|
|
|
|
|
|
my @c1 = caller (1); |
|
59
|
0
|
|
|
|
|
|
my @c2 = caller (2); |
|
60
|
0
|
|
|
|
|
|
print STDERR "$$: TRACE IN : $c1[3] (-> $c2[3])\n"; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Level 2: Methodenaufrufe mit Parametern |
|
64
|
0
|
0
|
|
|
|
|
if ( $debug == 3 ) { |
|
65
|
|
|
|
|
|
|
package DB; |
|
66
|
0
|
|
|
|
|
|
my @c = caller (1); |
|
67
|
0
|
|
|
|
|
|
my $args = '"'.(join('","',@DB::args)).'"'; |
|
68
|
0
|
|
|
|
|
|
my @c2 = caller (2); |
|
69
|
0
|
|
|
|
|
|
print STDERR "$$: TRACE IN : $c[3] (-> $c2[3])\n\t($args)\n"; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
1; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub trace_out { |
|
76
|
0
|
|
|
0
|
0
|
|
my $thing = shift; |
|
77
|
0
|
|
|
|
|
|
my $debug = $CIPP::DEBUG; |
|
78
|
0
|
0
|
0
|
|
|
|
$debug = $thing->{debug} if ref $thing and $thing->{debug}; |
|
79
|
0
|
0
|
|
|
|
|
return if $debug < 2; |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my @c1 = caller (1); |
|
82
|
0
|
|
|
|
|
|
my @c2 = caller (2); |
|
83
|
0
|
|
|
|
|
|
print STDERR "$$: TRACE OUT: $c1[3] (-> $c2[3])"; |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
0
|
|
|
|
|
if ( $debug == 2 ) { |
|
86
|
0
|
|
|
|
|
|
print STDERR " DATA: ", Dumper(@_); |
|
87
|
|
|
|
|
|
|
} else { |
|
88
|
0
|
|
|
|
|
|
print STDERR "\n"; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
1; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub dump { |
|
95
|
0
|
|
|
0
|
0
|
|
my $thing = shift; |
|
96
|
|
|
|
|
|
|
# my $debug = $CIPP::DEBUG; |
|
97
|
|
|
|
|
|
|
# $debug = $thing->{debug} if ref $thing and $thing->{debug}; |
|
98
|
|
|
|
|
|
|
# return if not $debug; |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
0
|
|
|
|
|
if ( @_ ) { |
|
101
|
0
|
|
|
|
|
|
print STDERR Dumper(@_); |
|
102
|
|
|
|
|
|
|
} else { |
|
103
|
0
|
|
|
|
|
|
print STDERR Dumper($thing); |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub debug { |
|
108
|
0
|
|
|
0
|
0
|
|
my $thing = shift; |
|
109
|
0
|
|
|
|
|
|
my $debug = $CIPP::DEBUG; |
|
110
|
0
|
0
|
0
|
|
|
|
$debug = $thing->{debug} if ref $thing and $thing->{debug}; |
|
111
|
0
|
0
|
|
|
|
|
return if not $debug; |
|
112
|
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
my @c1 = caller (1); |
|
114
|
0
|
|
|
|
|
|
print STDERR "$$: DEBUG : $c1[3]: ", join (",", @_), "\n"; |
|
115
|
0
|
|
|
|
|
|
1; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub dump_html { |
|
119
|
0
|
|
|
0
|
0
|
|
my $thing = shift; |
|
120
|
|
|
|
|
|
|
|
|
121
|
0
|
0
|
|
|
|
|
if ( @_ ) { |
|
122
|
0
|
|
|
|
|
|
print "",Dumper(@_)," \n"; |
|
123
|
|
|
|
|
|
|
} else { |
|
124
|
0
|
|
|
|
|
|
print "",Dumper($thing)," \n"; |
|
125
|
|
|
|
|
|
|
} |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
1; |