line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::AttributeHelpers::MethodProvider::Bag; |
2
|
22
|
|
|
22
|
|
85
|
use Moose::Role; |
|
22
|
|
|
|
|
27
|
|
|
22
|
|
|
|
|
131
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.25'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with 'MooseX::AttributeHelpers::MethodProvider::ImmutableHash'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub add : method { |
9
|
2
|
|
|
2
|
1
|
10
|
my ($attr, $reader, $writer) = @_; |
10
|
2
|
|
|
34
|
|
14
|
return sub { $reader->($_[0])->{$_[1]}++ }; |
|
34
|
|
|
34
|
|
2566
|
|
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub delete : method { |
14
|
2
|
|
|
2
|
1
|
10
|
my ($attr, $reader, $writer) = @_; |
15
|
2
|
|
|
0
|
|
13
|
return sub { CORE::delete $reader->($_[0])->{$_[1]} }; |
|
0
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub reset : method { |
19
|
0
|
|
|
0
|
1
|
|
my ($attr, $reader, $writer) = @_; |
20
|
0
|
|
|
0
|
|
|
return sub { $reader->($_[0])->{$_[1]} = 0 }; |
|
0
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=pod |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=encoding UTF-8 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 NAME |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
MooseX::AttributeHelpers::MethodProvider::Bag |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 VERSION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
version 0.25 |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
This is a role which provides the method generators for |
42
|
|
|
|
|
|
|
L<MooseX::AttributeHelpers::Collection::Bag>. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This role is composed from the |
45
|
|
|
|
|
|
|
L<MooseX::AttributeHelpers::Collection::ImmutableHash> role. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=over 4 |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item B<meta> |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=back |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 PROVIDED METHODS |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=over 4 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item B<count> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item B<delete> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item B<empty> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item B<exists> |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item B<get> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item B<keys> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item B<add> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item B<reset> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item B<values> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item B<kv> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SUPPORT |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-AttributeHelpers> |
84
|
|
|
|
|
|
|
(or L<bug-MooseX-AttributeHelpers@rt.cpan.org|mailto:bug-MooseX-AttributeHelpers@rt.cpan.org>). |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
87
|
|
|
|
|
|
|
L<http://lists.perl.org/list/moose.html>. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
90
|
|
|
|
|
|
|
L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Stevan Little <stevan@iinteractive.com> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Stevan Little and Infinity Interactive, Inc. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
101
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |