| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
############################################################################## |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or |
|
4
|
|
|
|
|
|
|
# modify it under the terms of the GNU Library General Public |
|
5
|
|
|
|
|
|
|
# License as published by the Free Software Foundation; either |
|
6
|
|
|
|
|
|
|
# version 2 of the License, or (at your option) any later version. |
|
7
|
|
|
|
|
|
|
# |
|
8
|
|
|
|
|
|
|
# This library is distributed in the hope that it will be useful, |
|
9
|
|
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10
|
|
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
11
|
|
|
|
|
|
|
# Library General Public License for more details. |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# You should have received a copy of the GNU Library General Public |
|
14
|
|
|
|
|
|
|
# License along with this library; if not, write to the |
|
15
|
|
|
|
|
|
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
16
|
|
|
|
|
|
|
# Boston, MA 02111-1307, USA. |
|
17
|
|
|
|
|
|
|
# |
|
18
|
|
|
|
|
|
|
# Copyright (C) 1998-2004 Jabber Software Foundation http://jabber.org/ |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
############################################################################## |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Net::XMPP::Debug; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Net::XMPP::Debug - XMPP Debug Module |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Net::XMPP::Debug is a module that provides a developer easy access |
|
31
|
|
|
|
|
|
|
to logging debug information. |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Debug is a helper module for the Net::XMPP modules. It provides |
|
36
|
|
|
|
|
|
|
the Net::XMPP modules with an object to control where, how, and |
|
37
|
|
|
|
|
|
|
what is logged. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 Basic Functions |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$Debug = Net::XMPP::Debug->new(); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$Debug->Init( |
|
44
|
|
|
|
|
|
|
level => 2, |
|
45
|
|
|
|
|
|
|
file => "stdout", |
|
46
|
|
|
|
|
|
|
header =>"MyScript"); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$Debug->Log0("Connection established"); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 METHODS |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 Basic Functions |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=over 4 |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=item new |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
new(hash) |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
creates the Debug object. The hash argument is passed |
|
61
|
|
|
|
|
|
|
to the Init function. See that function description |
|
62
|
|
|
|
|
|
|
below for the valid settings. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item Init |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Init( |
|
67
|
|
|
|
|
|
|
level => integer, |
|
68
|
|
|
|
|
|
|
file => string, |
|
69
|
|
|
|
|
|
|
header => string, |
|
70
|
|
|
|
|
|
|
setdefault => 0|1, |
|
71
|
|
|
|
|
|
|
usedefault => 0|1, |
|
72
|
|
|
|
|
|
|
time => 0|1) |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
initializes the debug object. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
The B determines the maximum level of debug |
|
77
|
|
|
|
|
|
|
messages to log: |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
0 - Base level Output (default) |
|
80
|
|
|
|
|
|
|
1 - High level API calls |
|
81
|
|
|
|
|
|
|
2 - Low level API calls |
|
82
|
|
|
|
|
|
|
... |
|
83
|
|
|
|
|
|
|
N - Whatever you want.... |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
The B determines where the debug log |
|
86
|
|
|
|
|
|
|
goes. You can either specify a path to |
|
87
|
|
|
|
|
|
|
a file, or "stdout" (the default). "stdout" |
|
88
|
|
|
|
|
|
|
tells Debug to send all of the debug info |
|
89
|
|
|
|
|
|
|
sent to this object to go to stdout. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
B is a string that will preappended |
|
92
|
|
|
|
|
|
|
to the beginning of all log entries. This |
|
93
|
|
|
|
|
|
|
makes it easier to see what generated the |
|
94
|
|
|
|
|
|
|
log entry (default is "Debug"). |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
B saves the current filehandle |
|
97
|
|
|
|
|
|
|
and makes it available for other Debug |
|
98
|
|
|
|
|
|
|
objects to use. To use the default set |
|
99
|
|
|
|
|
|
|
B to 1. |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
The B |
|
102
|
|
|
|
|
|
|
timestamp to the beginning of each logged line. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item LogN |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
LogN(array) |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Logs the elements of the array at the corresponding |
|
109
|
|
|
|
|
|
|
debug level N. If you pass in a reference to an |
|
110
|
|
|
|
|
|
|
array or hash then they are printed in a readable |
|
111
|
|
|
|
|
|
|
way. (ie... Log0, Log2, Log100, etc...) |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=back |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 EXAMPLE |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
$Debug = Net::XMPP:Debug->new(level=>2, |
|
118
|
|
|
|
|
|
|
header=>"Example"); |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
$Debug->Log0("test"); |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
$Debug->Log2("level 2 test"); |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
$hash{a} = "atest"; |
|
125
|
|
|
|
|
|
|
$hash{b} = "btest"; |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
$Debug->Log1("hashtest", \%hash); |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
You would get the following log: |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Example: test |
|
132
|
|
|
|
|
|
|
Example: level 2 test |
|
133
|
|
|
|
|
|
|
Example: hashtest { a=>"atest" b=>"btest" } |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
If you had set the level to 1 instead of 2 you would get: |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Example: test |
|
138
|
|
|
|
|
|
|
Example: hashtest { a=>"atest" b=>"btest" } |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 AUTHOR |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Originally authored by Ryan Eatmon. |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Previously maintained by Eric Hacker. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Currently maintained by Darian Anthony Patrick. |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This module is free software, you can redistribute it and/or modify it |
|
151
|
|
|
|
|
|
|
under the LGPL 2.1. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
require 5.008; |
|
156
|
15
|
|
|
15
|
|
70
|
use strict; |
|
|
15
|
|
|
|
|
21
|
|
|
|
15
|
|
|
|
|
567
|
|
|
157
|
15
|
|
|
15
|
|
74
|
use warnings; |
|
|
15
|
|
|
|
|
21
|
|
|
|
15
|
|
|
|
|
501
|
|
|
158
|
15
|
|
|
15
|
|
59
|
use FileHandle; |
|
|
15
|
|
|
|
|
18
|
|
|
|
15
|
|
|
|
|
209
|
|
|
159
|
15
|
|
|
15
|
|
4640
|
use Carp; |
|
|
15
|
|
|
|
|
24
|
|
|
|
15
|
|
|
|
|
1043
|
|
|
160
|
15
|
|
|
15
|
|
63
|
use vars qw( %HANDLES $DEFAULT $DEFAULTLEVEL $DEFAULTTIME $AUTOLOAD ); |
|
|
15
|
|
|
|
|
18
|
|
|
|
15
|
|
|
|
|
14454
|
|
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
$DEFAULTLEVEL = -1; |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub new |
|
165
|
|
|
|
|
|
|
{ |
|
166
|
32
|
|
|
32
|
1
|
9902
|
my $proto = shift; |
|
167
|
32
|
|
|
|
|
89
|
my $self = { }; |
|
168
|
32
|
|
|
|
|
89
|
bless($self, $proto); |
|
169
|
|
|
|
|
|
|
|
|
170
|
32
|
|
|
|
|
163
|
$self->Init(@_); |
|
171
|
|
|
|
|
|
|
|
|
172
|
32
|
|
|
|
|
90
|
return $self; |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
############################################################################## |
|
177
|
|
|
|
|
|
|
# |
|
178
|
|
|
|
|
|
|
# Init - opens the fielhandle and initializes the Debug object. |
|
179
|
|
|
|
|
|
|
# |
|
180
|
|
|
|
|
|
|
############################################################################## |
|
181
|
|
|
|
|
|
|
sub Init |
|
182
|
|
|
|
|
|
|
{ |
|
183
|
32
|
|
|
32
|
1
|
56
|
my $self = shift; |
|
184
|
|
|
|
|
|
|
|
|
185
|
32
|
|
|
|
|
57
|
my %args; |
|
186
|
32
|
|
|
|
|
145
|
while($#_ >= 0) { $args{ lc pop(@_) } = pop(@_); } |
|
|
109
|
|
|
|
|
393
|
|
|
187
|
|
|
|
|
|
|
|
|
188
|
32
|
100
|
66
|
|
|
259
|
delete($args{file}) if (defined $args{file} && lc($args{file}) eq "stdout"); |
|
189
|
|
|
|
|
|
|
|
|
190
|
32
|
100
|
|
|
|
184
|
$args{time} = 0 if !exists($args{time}); |
|
191
|
32
|
100
|
|
|
|
107
|
$args{setdefault} = 0 if !exists($args{setdefault}); |
|
192
|
32
|
100
|
|
|
|
113
|
$args{usedefault} = 0 if !exists($args{usedefault}); |
|
193
|
|
|
|
|
|
|
|
|
194
|
32
|
|
|
|
|
201
|
$self->{TIME} = $args{time}; |
|
195
|
|
|
|
|
|
|
|
|
196
|
32
|
100
|
|
|
|
115
|
if ($args{usedefault} == 1) |
|
197
|
|
|
|
|
|
|
{ |
|
198
|
15
|
|
|
|
|
26
|
$args{setdefault} = 0; |
|
199
|
15
|
|
|
|
|
29
|
$self->{USEDEFAULT} = 1; |
|
200
|
|
|
|
|
|
|
} |
|
201
|
|
|
|
|
|
|
else |
|
202
|
|
|
|
|
|
|
{ |
|
203
|
17
|
|
|
|
|
47
|
$self->{LEVEL} = 0; |
|
204
|
17
|
50
|
|
|
|
69
|
$self->{LEVEL} = $args{level} if exists($args{level}); |
|
205
|
17
|
50
|
|
|
|
62
|
if ($self->{LEVEL} >= 0) |
|
206
|
|
|
|
|
|
|
{ |
|
207
|
|
|
|
|
|
|
|
|
208
|
0
|
|
|
|
|
0
|
$self->{HANDLE} = FileHandle->new(">&STDERR"); |
|
209
|
0
|
|
|
|
|
0
|
$self->{HANDLE}->autoflush(1); |
|
210
|
0
|
0
|
|
|
|
0
|
if (exists($args{file})) |
|
211
|
|
|
|
|
|
|
{ |
|
212
|
0
|
0
|
|
|
|
0
|
if (exists($Net::XMPP::Debug::HANDLES{$args{file}})) |
|
213
|
|
|
|
|
|
|
{ |
|
214
|
0
|
|
|
|
|
0
|
$self->{HANDLE} = $Net::XMPP::Debug::HANDLES{$args{file}}; |
|
215
|
0
|
|
|
|
|
0
|
$self->{HANDLE}->autoflush(1); |
|
216
|
|
|
|
|
|
|
} |
|
217
|
|
|
|
|
|
|
else |
|
218
|
|
|
|
|
|
|
{ |
|
219
|
0
|
0
|
|
|
|
0
|
if (-e $args{file}) |
|
220
|
|
|
|
|
|
|
{ |
|
221
|
0
|
0
|
|
|
|
0
|
if (-w $args{file}) |
|
222
|
|
|
|
|
|
|
{ |
|
223
|
0
|
|
|
|
|
0
|
$self->{HANDLE} = FileHandle->new(">$args{file}"); |
|
224
|
0
|
0
|
|
|
|
0
|
if (defined($self->{HANDLE})) |
|
225
|
|
|
|
|
|
|
{ |
|
226
|
0
|
|
|
|
|
0
|
$self->{HANDLE}->autoflush(1); |
|
227
|
0
|
|
|
|
|
0
|
$Net::XMPP::Debug::HANDLES{$args{file}} = $self->{HANDLE}; |
|
228
|
|
|
|
|
|
|
} |
|
229
|
|
|
|
|
|
|
else |
|
230
|
|
|
|
|
|
|
{ |
|
231
|
0
|
|
|
|
|
0
|
print STDERR "ERROR: Debug filehandle could not be opened.\n"; |
|
232
|
0
|
|
|
|
|
0
|
print STDERR" Debugging disabled.\n"; |
|
233
|
0
|
|
|
|
|
0
|
print STDERR " ($!)\n"; |
|
234
|
0
|
|
|
|
|
0
|
$self->{LEVEL} = -1; |
|
235
|
|
|
|
|
|
|
} |
|
236
|
|
|
|
|
|
|
} |
|
237
|
|
|
|
|
|
|
else |
|
238
|
|
|
|
|
|
|
{ |
|
239
|
0
|
|
|
|
|
0
|
print STDERR "ERROR: You do not have permission to write to $args{file}.\n"; |
|
240
|
0
|
|
|
|
|
0
|
print STDERR" Debugging disabled.\n"; |
|
241
|
0
|
|
|
|
|
0
|
$self->{LEVEL} = -1; |
|
242
|
|
|
|
|
|
|
} |
|
243
|
|
|
|
|
|
|
} |
|
244
|
|
|
|
|
|
|
else |
|
245
|
|
|
|
|
|
|
{ |
|
246
|
0
|
|
|
|
|
0
|
$self->{HANDLE} = FileHandle->new(">$args{file}"); |
|
247
|
0
|
0
|
|
|
|
0
|
if (defined($self->{HANDLE})) |
|
248
|
|
|
|
|
|
|
{ |
|
249
|
0
|
|
|
|
|
0
|
$self->{HANDLE}->autoflush(1); |
|
250
|
0
|
|
|
|
|
0
|
$Net::XMPP::Debug::HANDLES{$args{file}} = $self->{HANDLE}; |
|
251
|
|
|
|
|
|
|
} |
|
252
|
|
|
|
|
|
|
else |
|
253
|
|
|
|
|
|
|
{ |
|
254
|
0
|
|
|
|
|
0
|
print STDERR "ERROR: Debug filehandle could not be opened.\n"; |
|
255
|
0
|
|
|
|
|
0
|
print STDERR" Debugging disabled.\n"; |
|
256
|
0
|
|
|
|
|
0
|
print STDERR " ($!)\n"; |
|
257
|
0
|
|
|
|
|
0
|
$self->{LEVEL} = -1; |
|
258
|
|
|
|
|
|
|
} |
|
259
|
|
|
|
|
|
|
} |
|
260
|
|
|
|
|
|
|
} |
|
261
|
|
|
|
|
|
|
} |
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
} |
|
264
|
32
|
100
|
|
|
|
108
|
if ($args{setdefault} == 1) |
|
265
|
|
|
|
|
|
|
{ |
|
266
|
17
|
|
|
|
|
40
|
$Net::XMPP::Debug::DEFAULT = $self->{HANDLE}; |
|
267
|
17
|
|
|
|
|
37
|
$Net::XMPP::Debug::DEFAULTLEVEL = $self->{LEVEL}; |
|
268
|
17
|
|
|
|
|
41
|
$Net::XMPP::Debug::DEFAULTTIME = $self->{TIME}; |
|
269
|
|
|
|
|
|
|
} |
|
270
|
|
|
|
|
|
|
|
|
271
|
32
|
|
|
|
|
78
|
$self->{HEADER} = "Debug"; |
|
272
|
32
|
50
|
|
|
|
191
|
$self->{HEADER} = $args{header} if exists($args{header}); |
|
273
|
|
|
|
|
|
|
} |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
############################################################################## |
|
277
|
|
|
|
|
|
|
# |
|
278
|
|
|
|
|
|
|
# Log - takes the limit and the array to log and logs them |
|
279
|
|
|
|
|
|
|
# |
|
280
|
|
|
|
|
|
|
############################################################################## |
|
281
|
|
|
|
|
|
|
sub Log |
|
282
|
|
|
|
|
|
|
{ |
|
283
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
284
|
0
|
|
|
|
|
0
|
my (@args) = @_; |
|
285
|
|
|
|
|
|
|
|
|
286
|
0
|
|
|
|
|
0
|
my $fh = $self->{HANDLE}; |
|
287
|
0
|
0
|
|
|
|
0
|
$fh = $Net::XMPP::Debug::DEFAULT if exists($self->{USEDEFAULT}); |
|
288
|
0
|
0
|
|
|
|
0
|
return if not $fh; |
|
289
|
|
|
|
|
|
|
|
|
290
|
0
|
|
|
|
|
0
|
my $string = ""; |
|
291
|
|
|
|
|
|
|
|
|
292
|
0
|
|
|
|
|
0
|
my $testTime = $self->{TIME}; |
|
293
|
0
|
0
|
|
|
|
0
|
$testTime = $Net::XMPP::Debug::DEFAULTTIME if exists($self->{USEDEFAULT}); |
|
294
|
|
|
|
|
|
|
|
|
295
|
0
|
0
|
|
|
|
0
|
$string .= "[".&Net::XMPP::GetTimeStamp("local",time,"short")."] " |
|
296
|
|
|
|
|
|
|
if ($testTime == 1); |
|
297
|
0
|
|
|
|
|
0
|
$string .= $self->{HEADER}.": "; |
|
298
|
|
|
|
|
|
|
|
|
299
|
0
|
|
|
|
|
0
|
my $arg; |
|
300
|
|
|
|
|
|
|
|
|
301
|
0
|
|
|
|
|
0
|
foreach $arg (@args) |
|
302
|
|
|
|
|
|
|
{ |
|
303
|
0
|
0
|
|
|
|
0
|
if (ref($arg) eq "HASH") |
|
304
|
|
|
|
|
|
|
{ |
|
305
|
0
|
|
|
|
|
0
|
$string .= " {"; |
|
306
|
0
|
|
|
|
|
0
|
my $key; |
|
307
|
0
|
|
|
|
|
0
|
foreach $key (sort {$a cmp $b} keys(%{$arg})) |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
308
|
|
|
|
|
|
|
{ |
|
309
|
0
|
|
|
|
|
0
|
$string .= " ".$key."=>'".$arg->{$key}."'"; |
|
310
|
|
|
|
|
|
|
} |
|
311
|
0
|
|
|
|
|
0
|
$string .= " }"; |
|
312
|
|
|
|
|
|
|
} |
|
313
|
|
|
|
|
|
|
else |
|
314
|
|
|
|
|
|
|
{ |
|
315
|
0
|
0
|
|
|
|
0
|
if (ref($arg) eq "ARRAY") |
|
316
|
|
|
|
|
|
|
{ |
|
317
|
0
|
|
|
|
|
0
|
$string .= " [ ".join(" ",@{$arg})." ]"; |
|
|
0
|
|
|
|
|
0
|
|
|
318
|
|
|
|
|
|
|
} else { |
|
319
|
0
|
|
|
|
|
0
|
$string .= $arg; |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
} |
|
322
|
|
|
|
|
|
|
} |
|
323
|
0
|
|
|
|
|
0
|
print $fh "$string\n"; |
|
324
|
0
|
|
|
|
|
0
|
return 1; |
|
325
|
|
|
|
|
|
|
} |
|
326
|
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
############################################################################## |
|
329
|
|
|
|
|
|
|
# |
|
330
|
|
|
|
|
|
|
# AUTOLOAD - if a function is called that is not defined then this function |
|
331
|
|
|
|
|
|
|
# will examine the function name and either give an error or call |
|
332
|
|
|
|
|
|
|
# the appropriate function. |
|
333
|
|
|
|
|
|
|
# |
|
334
|
|
|
|
|
|
|
############################################################################## |
|
335
|
|
|
|
|
|
|
sub AUTOLOAD |
|
336
|
|
|
|
|
|
|
{ |
|
337
|
2185
|
|
|
2185
|
|
1929
|
my $self = shift; |
|
338
|
2185
|
50
|
|
|
|
4733
|
return if ($AUTOLOAD =~ /::DESTROY$/); |
|
339
|
2185
|
|
|
|
|
7506
|
my ($function) = ($AUTOLOAD =~ /\:\:(.*)$/); |
|
340
|
2185
|
50
|
|
|
|
5756
|
croak("$function not defined") if !($function =~ /Log\d+/); |
|
341
|
2185
|
|
|
|
|
4180
|
my ($level) = ($function =~ /Log(\d+)/); |
|
342
|
2185
|
100
|
|
|
|
8683
|
return 0 if ($level > (exists($self->{USEDEFAULT}) ? $Net::XMPP::Debug::DEFAULTLEVEL : $self->{LEVEL})); |
|
|
|
50
|
|
|
|
|
|
|
343
|
0
|
|
|
|
|
0
|
$self->Log(@_); |
|
344
|
|
|
|
|
|
|
} |
|
345
|
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
############################################################################## |
|
348
|
|
|
|
|
|
|
# |
|
349
|
|
|
|
|
|
|
# GetHandle - returns the filehandle being used by this object. |
|
350
|
|
|
|
|
|
|
# |
|
351
|
|
|
|
|
|
|
############################################################################## |
|
352
|
|
|
|
|
|
|
sub GetHandle |
|
353
|
|
|
|
|
|
|
{ |
|
354
|
11
|
|
|
11
|
0
|
20
|
my $self = shift; |
|
355
|
11
|
|
|
|
|
53
|
return $self->{HANDLE}; |
|
356
|
|
|
|
|
|
|
} |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
############################################################################## |
|
360
|
|
|
|
|
|
|
# |
|
361
|
|
|
|
|
|
|
# GetLevel - returns the debug level used by this object. |
|
362
|
|
|
|
|
|
|
# |
|
363
|
|
|
|
|
|
|
############################################################################## |
|
364
|
|
|
|
|
|
|
sub GetLevel |
|
365
|
|
|
|
|
|
|
{ |
|
366
|
11
|
|
|
11
|
0
|
17
|
my $self = shift; |
|
367
|
11
|
|
|
|
|
51
|
return $self->{LEVEL}; |
|
368
|
|
|
|
|
|
|
} |
|
369
|
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
############################################################################## |
|
372
|
|
|
|
|
|
|
# |
|
373
|
|
|
|
|
|
|
# GetTime - returns the debug time used by this object. |
|
374
|
|
|
|
|
|
|
# |
|
375
|
|
|
|
|
|
|
############################################################################## |
|
376
|
|
|
|
|
|
|
sub GetTime |
|
377
|
|
|
|
|
|
|
{ |
|
378
|
11
|
|
|
11
|
0
|
19
|
my $self = shift; |
|
379
|
11
|
|
|
|
|
106
|
return $self->{TIME}; |
|
380
|
|
|
|
|
|
|
} |
|
381
|
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
1; |