Commit | Line | Data |
e3c07b19 |
1 | |
2 | package Moose::AttributeHelpers::Trait::Collection::Bag; |
3 | use Moose::Role; |
4 | use Moose::Util::TypeConstraints; |
5 | |
115601b6 |
6 | our $VERSION = '0.85'; |
e3c07b19 |
7 | $VERSION = eval $VERSION; |
8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | |
10 | use Moose::AttributeHelpers::MethodProvider::Bag; |
11 | |
12 | with 'Moose::AttributeHelpers::Trait::Collection'; |
13 | |
14 | has 'method_provider' => ( |
15 | is => 'ro', |
16 | isa => 'ClassName', |
17 | predicate => 'has_method_provider', |
18 | default => 'Moose::AttributeHelpers::MethodProvider::Bag' |
19 | ); |
20 | |
21 | subtype 'Bag' => as 'HashRef[Int]'; |
22 | |
23 | sub helper_type { 'Bag' } |
24 | |
2edb73d9 |
25 | sub _default_default { sub { {} } } |
e3c07b19 |
26 | |
27 | no Moose::Role; |
28 | no Moose::Util::TypeConstraints; |
29 | |
30 | # register the alias ... |
31 | package # hide me from search.cpan.org |
32 | Moose::Meta::Attribute::Custom::Trait::Collection::Bag; |
33 | sub register_implementation { |
34 | 'Moose::AttributeHelpers::Trait::Collection::Bag' |
35 | } |
36 | |
37 | 1; |
38 | |
39 | __END__ |
40 | |
41 | =pod |
42 | |
43 | =head1 NAME |
44 | |
45 | Moose::AttributeHelpers::Collection::Bag |
46 | |
47 | =head1 SYNOPSIS |
48 | |
49 | package Stuff; |
50 | use Moose; |
51 | use Moose::AttributeHelpers; |
52 | |
53 | has 'word_histogram' => ( |
54 | metaclass => 'Collection::Bag', |
55 | is => 'ro', |
56 | isa => 'Bag', # optional ... as is defalt |
5f3663b2 |
57 | handles => { |
58 | add_word => 'add', |
59 | get_count_for => 'get', |
60 | has_any_words => 'empty', |
61 | num_words => 'count', |
62 | delete_word => 'delete', |
e3c07b19 |
63 | } |
64 | ); |
65 | |
66 | =head1 DESCRIPTION |
67 | |
68 | This module provides a Bag attribute which provides a number of |
69 | bag-like operations. See L<Moose::AttributeHelpers::MethodProvider::Bag> |
70 | for more details. |
71 | |
72 | =head1 METHODS |
73 | |
74 | =over 4 |
75 | |
76 | =item B<meta> |
77 | |
78 | =item B<method_provider> |
79 | |
80 | =item B<has_method_provider> |
81 | |
82 | =item B<helper_type> |
83 | |
25d86888 |
84 | =item B<process_options_for_handles> |
e3c07b19 |
85 | |
86 | =back |
87 | |
88 | =head1 BUGS |
89 | |
90 | All complex software has bugs lurking in it, and this module is no |
91 | exception. If you find a bug please either email me, or add the bug |
92 | to cpan-RT. |
93 | |
94 | =head1 AUTHOR |
95 | |
96 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
97 | |
98 | =head1 COPYRIGHT AND LICENSE |
99 | |
100 | Copyright 2007-2009 by Infinity Interactive, Inc. |
101 | |
102 | L<http://www.iinteractive.com> |
103 | |
104 | This library is free software; you can redistribute it and/or modify |
105 | it under the same terms as Perl itself. |
106 | |
107 | =cut |