Lots of code cleanup in M::AH traits.
[gitmo/Moose.git] / lib / Moose / AttributeHelpers / Trait / Collection / Bag.pm
CommitLineData
e3c07b19 1
2package Moose::AttributeHelpers::Trait::Collection::Bag;
3use Moose::Role;
4use Moose::Util::TypeConstraints;
5
115601b6 6our $VERSION = '0.85';
e3c07b19 7$VERSION = eval $VERSION;
8our $AUTHORITY = 'cpan:STEVAN';
9
10use Moose::AttributeHelpers::MethodProvider::Bag;
11
12with 'Moose::AttributeHelpers::Trait::Collection';
13
14has 'method_provider' => (
15 is => 'ro',
16 isa => 'ClassName',
17 predicate => 'has_method_provider',
18 default => 'Moose::AttributeHelpers::MethodProvider::Bag'
19);
20
21subtype 'Bag' => as 'HashRef[Int]';
22
23sub helper_type { 'Bag' }
24
2edb73d9 25sub _default_default { sub { {} } }
e3c07b19 26
27no Moose::Role;
28no Moose::Util::TypeConstraints;
29
30# register the alias ...
31package # hide me from search.cpan.org
32 Moose::Meta::Attribute::Custom::Trait::Collection::Bag;
33sub register_implementation {
34 'Moose::AttributeHelpers::Trait::Collection::Bag'
35}
36
371;
38
39__END__
40
41=pod
42
43=head1 NAME
44
45Moose::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
68This module provides a Bag attribute which provides a number of
69bag-like operations. See L<Moose::AttributeHelpers::MethodProvider::Bag>
70for 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
90All complex software has bugs lurking in it, and this module is no
91exception. If you find a bug please either email me, or add the bug
92to cpan-RT.
93
94=head1 AUTHOR
95
96Stevan Little E<lt>stevan@iinteractive.comE<gt>
97
98=head1 COPYRIGHT AND LICENSE
99
100Copyright 2007-2009 by Infinity Interactive, Inc.
101
102L<http://www.iinteractive.com>
103
104This library is free software; you can redistribute it and/or modify
105it under the same terms as Perl itself.
106
107=cut