line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MouseX::AttributeHelpers::Collection::ImmutableHash; |
2
|
11
|
|
|
35
|
|
130351
|
use Mouse; |
|
11
|
|
|
|
|
26
|
|
|
11
|
|
|
|
|
88
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
extends 'MouseX::AttributeHelpers::Base'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has '+method_constructors' => ( |
7
|
|
|
|
|
|
|
default => sub { |
8
|
|
|
|
|
|
|
return +{ |
9
|
|
|
|
|
|
|
exists => sub { |
10
|
|
|
|
|
|
|
my ($attr, $name) = @_; |
11
|
48
|
100
|
|
48
|
|
7980
|
return sub { exists $_[0]->$name()->{$_[1]} ? 1 : 0 }; |
12
|
|
|
|
|
|
|
}, |
13
|
|
|
|
|
|
|
get => sub { |
14
|
|
|
|
|
|
|
my ($attr, $name) = @_; |
15
|
|
|
|
|
|
|
return sub { |
16
|
48
|
100
|
|
48
|
|
350
|
if (@_ == 2) { |
|
|
|
|
6
|
|
|
|
17
|
25
|
|
|
|
|
197
|
$_[0]->$name()->{$_[1]}; |
18
|
|
|
|
|
|
|
} else { |
19
|
1
|
|
|
|
|
5
|
my $h = shift->$name(); |
20
|
1
|
|
|
|
|
4
|
@{ $h }{@_}; |
|
23
|
|
|
|
|
184
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
}, |
24
|
|
|
|
|
|
|
keys => sub { |
25
|
|
|
|
|
|
|
my ($attr, $name) = @_; |
26
|
31
|
|
|
43
|
|
161
|
return sub { keys %{ $_[0]->$name() } }; |
|
17
|
|
|
|
|
10429
|
|
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
values => sub { |
29
|
|
|
|
|
|
|
my ($attr, $name) = @_; |
30
|
16
|
|
|
18
|
|
14660
|
return sub { values %{ $_[0]->$name() } }; |
|
8
|
|
|
|
|
222
|
|
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
kv => sub { |
33
|
|
|
|
|
|
|
my ($attr, $name) = @_; |
34
|
|
|
|
|
|
|
return sub { |
35
|
6
|
|
|
10
|
|
37
|
my $h = $_[0]->$name(); |
36
|
6
|
|
|
|
|
22
|
map { [ $_, $h->{$_} ] } keys %$h; |
|
18
|
|
|
|
|
58
|
|
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
count => sub { |
40
|
|
|
|
|
|
|
my ($attr, $name) = @_; |
41
|
12
|
|
|
16
|
|
27
|
return sub { scalar keys %{ $_[0]->$name() } }; |
|
12
|
|
|
|
|
96
|
|
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
empty => sub { |
44
|
|
|
|
|
|
|
my ($attr, $name) = @_; |
45
|
9
|
100
|
|
17
|
|
63
|
return sub { scalar keys %{ $_[0]->$name() } ? 1 : 0 }; |
|
9
|
|
|
|
|
118
|
|
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
1
|
0
|
sub helper_type { 'HashRef' } |
52
|
|
|
|
|
|
|
|
53
|
11
|
|
|
11
|
|
8680
|
no Mouse; |
|
11
|
|
|
|
|
98
|
|
|
11
|
|
|
|
|
61
|
|
54
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(inline_constructor => 0); |
55
|
|
|
|
|
|
|
__END__ |