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