blob: a0f4e196793dfa8995567c4799403db16bec293b (
plain)
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
|
package TQt::debug;
use TQt;
our %channel = (
'ambiguous' => 0x01,
'autoload' => 0x02,
'calls' => 0x04,
'gc' => 0x08,
'virtual' => 0x10,
'verbose' => 0x20,
'all' => 0xffff
);
sub import {
shift;
my $db = (@_)? 0x0000 : (0x01|0x20);
my $usage = 0;
for my $ch(@_) {
if( exists $channel{$ch}) {
$db |= $channel{$ch};
} else {
warn "Unknown debugging channel: $ch\n";
$usage++;
}
}
TQt::_internal::setDebug($db);
print "Available channels: \n\t".
join("\n\t", sort keys %channel).
"\n" if $usage;
}
sub unimport {
TQt::_internal::setDebug(0);
}
1;
|