line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::CoverableModifiers; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
753
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
304
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
2
|
50
|
|
2
|
|
14
|
if ($INC{'Devel/Cover.pm'}) { |
6
|
2
|
|
|
|
|
952
|
require Devel::Declare; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
20144
|
use 5.008_001; |
|
2
|
|
|
|
|
121
|
|
|
2
|
|
|
|
|
2139
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.30'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our ($Declarator, $Offset); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub skip_declarator { |
16
|
2
|
|
|
2
|
0
|
11
|
$Offset += Devel::Declare::toke_move_past_token($Offset); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub gen_parser { |
20
|
6
|
|
|
6
|
0
|
11
|
my $caller = shift; |
21
|
6
|
|
|
|
|
12
|
my $cnt = 0; |
22
|
|
|
|
|
|
|
sub { |
23
|
2
|
|
|
2
|
|
193
|
local ($Declarator, $Offset) = @_; |
24
|
2
|
|
|
|
|
5
|
my $start = $Offset; |
25
|
2
|
|
|
|
|
3
|
skip_declarator; |
26
|
2
|
|
|
|
|
3
|
my $pos = $Offset; |
27
|
2
|
|
|
|
|
15
|
my $linestr = Devel::Declare::get_linestr(); |
28
|
2
|
|
|
|
|
8
|
while (my $char = substr($linestr, $pos, 1)) { |
29
|
12
|
50
|
33
|
|
|
47
|
return if $char eq '{' || $char eq '&'; |
30
|
12
|
100
|
|
|
|
24
|
if (substr($linestr, $pos, 2) eq '=>') { |
31
|
2
|
|
|
|
|
4
|
last; |
32
|
|
|
|
|
|
|
} |
33
|
10
|
|
|
|
|
23
|
++$pos; |
34
|
|
|
|
|
|
|
} |
35
|
2
|
|
|
|
|
9
|
my ($name) = substr($linestr, $Offset, $pos - $Offset) =~ m/(\w+)/; |
36
|
2
|
|
|
|
|
7
|
my $modifier_name = "__${Declarator}_${name}_${cnt}"; |
37
|
2
|
|
|
|
|
6
|
substr($linestr, $pos, 2) = |
38
|
|
|
|
|
|
|
"=> *$modifier_name ="; |
39
|
2
|
|
|
|
|
5
|
Devel::Declare::set_linestr($linestr); |
40
|
2
|
|
|
|
|
15
|
++$cnt; |
41
|
|
|
|
|
|
|
} |
42
|
6
|
|
|
|
|
179
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub import { |
45
|
2
|
|
|
2
|
|
12
|
my $class = shift; |
46
|
2
|
|
|
|
|
8
|
my $caller = caller; |
47
|
|
|
|
|
|
|
|
48
|
2
|
50
|
|
|
|
16
|
return unless $INC{'Devel/Cover.pm'}; |
49
|
6
|
|
|
|
|
18
|
Devel::Declare->setup_for( |
50
|
|
|
|
|
|
|
$caller, |
51
|
2
|
|
|
|
|
6
|
{ map { $_ => { const => gen_parser($caller) } } |
52
|
|
|
|
|
|
|
qw(before around after) } |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
__END__ |