| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MR::IProto::Role::Debuggable; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=cut |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
22557
|
use Mouse::Role; |
|
|
1
|
|
|
|
|
1352
|
|
|
|
1
|
|
|
|
|
99
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=item debug |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Deug level. |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has debug => ( |
|
18
|
|
|
|
|
|
|
is => 'rw', |
|
19
|
|
|
|
|
|
|
isa => 'Int', |
|
20
|
|
|
|
|
|
|
default => 0, |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=item debug_cb |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Callback which is called when debug message is written. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has debug_cb => ( |
|
30
|
|
|
|
|
|
|
is => 'rw', |
|
31
|
|
|
|
|
|
|
isa => 'CodeRef', |
|
32
|
|
|
|
|
|
|
lazy_build => 1, |
|
33
|
|
|
|
|
|
|
); |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item dump_no_ints |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Skip print of integers in dump. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has dump_no_ints => ( |
|
42
|
|
|
|
|
|
|
is => 'ro', |
|
43
|
|
|
|
|
|
|
isa => 'Bool', |
|
44
|
|
|
|
|
|
|
); |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _build_debug_cb { |
|
47
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
48
|
0
|
|
|
|
|
|
my $prefix = ref $self; |
|
49
|
|
|
|
|
|
|
return sub { |
|
50
|
0
|
|
|
0
|
|
|
my ($msg) = @_; |
|
51
|
0
|
|
|
|
|
|
chomp $msg; |
|
52
|
0
|
|
|
|
|
|
warn sprintf "$prefix: $msg\n"; |
|
53
|
0
|
|
|
|
|
|
return; |
|
54
|
0
|
|
|
|
|
|
}; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _debug { |
|
58
|
0
|
|
|
0
|
|
|
$_[0]->debug_cb->($_[1]); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _debug_dump { |
|
62
|
0
|
|
|
0
|
|
|
my ($self, $msg, $datum) = @_; |
|
63
|
0
|
0
|
|
|
|
|
unless($self->dump_no_ints) { |
|
64
|
0
|
|
|
|
|
|
$msg .= join(' ', unpack('L*', $datum)); |
|
65
|
0
|
|
|
|
|
|
$msg .= ' > '; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
0
|
|
|
|
|
|
$msg .= join(' ', map { sprintf "%02x", $_ } unpack("C*", $datum)); |
|
|
0
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
$self->_debug($msg); |
|
69
|
0
|
|
|
|
|
|
return; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
1
|
|
|
1
|
|
661
|
no Mouse::Role; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
8
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |