line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MouseX::AttributeHelpers::Collection::Hash; |
2
|
5
|
|
|
7
|
|
4525
|
use Mouse; |
|
5
|
|
|
|
|
33782
|
|
|
5
|
|
|
|
|
120
|
|
3
|
5
|
|
|
5
|
|
5778
|
use MouseX::AttributeHelpers::Collection::ImmutableHash; |
|
5
|
|
|
|
|
248
|
|
|
5
|
|
|
|
|
1833
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'MouseX::AttributeHelpers::Base'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has '+method_constructors' => ( |
8
|
|
|
|
|
|
|
default => sub { |
9
|
|
|
|
|
|
|
my $attr = MouseX::AttributeHelpers::Collection::ImmutableHash->meta->get_attribute('method_constructors'); |
10
|
|
|
|
|
|
|
return +{ |
11
|
|
|
|
|
|
|
%{ $attr->default->() }, # apply MouseX::AttributeHelpers::Collection::ImmutableHash |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
set => sub { |
14
|
|
|
|
|
|
|
my ($attr, $name) = @_; |
15
|
|
|
|
|
|
|
return sub { |
16
|
4
|
50
|
|
4
|
|
20
|
if (@_ == 3) { |
|
|
|
|
2
|
|
|
|
17
|
4
|
|
|
|
|
36
|
$_[0]->$name()->{$_[1]} = $_[2]; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
else { |
20
|
0
|
|
|
|
|
0
|
my $self = shift; |
21
|
0
|
|
|
|
|
0
|
my (@k, @v); |
22
|
0
|
|
|
|
|
0
|
while (@_) { |
23
|
0
|
|
|
|
|
0
|
push @k, shift; |
24
|
0
|
|
|
|
|
0
|
push @v, shift; |
25
|
|
|
|
|
|
|
} |
26
|
0
|
|
|
|
|
0
|
@{ $self->$name() }{@k} = @v; |
|
0
|
|
|
|
|
0
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
}, |
30
|
|
|
|
|
|
|
clear => sub { |
31
|
|
|
|
|
|
|
my ($attr, $name) = @_; |
32
|
4
|
|
|
4
|
|
13
|
return sub { %{ $_[0]->$name() } = () }; |
|
4
|
|
|
|
|
39
|
|
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
delete => sub { |
35
|
|
|
|
|
|
|
my ($attr, $name) = @_; |
36
|
3
|
|
|
5
|
|
10
|
return sub { delete @{ shift->$name() }{@_} }; |
|
3
|
|
|
|
|
56
|
|
37
|
|
|
|
|
|
|
}, |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
0
|
sub helper_type { 'HashRef' } |
43
|
|
|
|
|
|
|
|
44
|
5
|
|
|
5
|
|
33
|
no Mouse; |
|
5
|
|
|
|
|
100
|
|
|
5
|
|
|
|
|
33
|
|
45
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(inline_constructor => 0); |
46
|
|
|
|
|
|
|
__END__ |