line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MouseX::AttributeHelpers::Counter; |
2
|
8
|
|
|
22
|
|
206173
|
use Mouse; |
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
69
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
extends 'MouseX::AttributeHelpers::Base'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has '+method_constructors' => ( |
7
|
|
|
|
|
|
|
default => sub { |
8
|
|
|
|
|
|
|
return +{ |
9
|
|
|
|
|
|
|
reset => sub { |
10
|
|
|
|
|
|
|
my ($attr, $name) = @_; |
11
|
|
|
|
|
|
|
return sub { |
12
|
6
|
|
|
6
|
|
3858
|
$_[0]->{$name} = do { |
13
|
4
|
50
|
|
|
|
29
|
if ($attr->has_default) { |
|
|
0
|
|
|
|
|
|
14
|
4
|
|
|
|
|
20
|
my $default = $attr->default; |
15
|
4
|
50
|
|
|
|
26
|
ref $default eq 'CODE' ? $default->($_[0]) : $default; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
elsif ($attr->has_builder) { |
18
|
0
|
|
|
|
|
0
|
my $builder = $attr->builder; |
19
|
0
|
|
|
|
|
0
|
$_[0]->$builder; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
set => sub { |
25
|
|
|
|
|
|
|
my (undef, $name) = @_; |
26
|
4
|
|
|
4
|
|
2214
|
return sub { $_[0]->{$name} = $_[1] }; |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
inc => sub { |
29
|
|
|
|
|
|
|
my (undef, $name) = @_; |
30
|
18
|
100
|
|
20
|
|
26500
|
return sub { $_[0]->{$name} += defined $_[1] ? $_[1] : 1 }; |
|
|
|
|
6
|
|
|
|
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
dec => sub { |
33
|
|
|
|
|
|
|
my (undef, $name) = @_; |
34
|
10
|
100
|
|
10
|
|
5283
|
return sub { $_[0]->{$name} -= defined $_[1] ? $_[1] : 1 }; |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
}; |
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
2
|
1
|
6
|
sub helper_type { 'Num' } |
41
|
4
|
|
|
4
|
1
|
21
|
sub helper_default { 0 } |
42
|
|
|
|
|
|
|
|
43
|
8
|
|
|
8
|
|
6519
|
no Mouse; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
40
|
|
44
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(inline_constructor => 0); |
45
|
|
|
|
|
|
|
__END__ |