Commit | Line | Data |
9a976497 |
1 | |
2 | package MooseX::AttributeHelpers::Collection::Bag; |
3 | use Moose; |
4 | use Moose::Util::TypeConstraints; |
e993b282 |
5 | use MooseX::AttributeHelpers::Sugar; |
9a976497 |
6 | |
7 | our $VERSION = '0.01'; |
8 | our $AUTHORITY = 'cpan:STEVAN'; |
9 | |
9a976497 |
10 | extends 'MooseX::AttributeHelpers::Collection'; |
11 | |
9a976497 |
12 | subtype 'Bag' => as 'HashRef[Int]'; |
13 | |
e993b282 |
14 | define_attribute_helper ( |
15 | default_options => { default => sub { {} } }, |
16 | helper_type => 'Bag', |
17 | method_provider => 'MooseX::AttributeHelpers::MethodProvider::Bag', |
18 | shortcut => 'Collection::Bag', |
19 | ); |
9a976497 |
20 | |
21 | no Moose; |
22 | no Moose::Util::TypeConstraints; |
e993b282 |
23 | no MooseX::AttributeHelpers::Sugar; |
9a976497 |
24 | |
25 | 1; |
26 | |
27 | __END__ |
28 | |
29 | =pod |
30 | |
31 | =head1 NAME |
32 | |
33 | MooseX::AttributeHelpers::Collection::Bag |
34 | |
35 | =head1 SYNOPSIS |
36 | |
37 | package Stuff; |
38 | use Moose; |
39 | use MooseX::AttributeHelpers; |
40 | |
41 | has 'word_histogram' => ( |
42 | metaclass => 'Collection::Bag', |
43 | is => 'ro', |
44 | isa => 'Bag', # optional ... as is defalt |
45 | provides => { |
46 | 'add' => 'add_word', |
47 | 'get' => 'get_count_for', |
48 | 'empty' => 'has_any_words', |
49 | 'count' => 'num_words', |
50 | 'delete' => 'delete_word', |
51 | } |
52 | ); |
53 | |
54 | =head1 DESCRIPTION |
55 | |
56 | This module provides a Bag attribute which provides a number of |
57 | bag-like operations. See L<MooseX::AttributeHelpers::MethodProvider::Bag> |
58 | for more details. |
59 | |
e993b282 |
60 | =head1 PROVIDED METHODS |
9a976497 |
61 | |
e993b282 |
62 | The methods for this metaclass are provided by |
63 | L<MooseX::AttributeHelpers::MethodProvider::Bag>. |
9a976497 |
64 | |
65 | =head1 BUGS |
66 | |
67 | All complex software has bugs lurking in it, and this module is no |
68 | exception. If you find a bug please either email me, or add the bug |
69 | to cpan-RT. |
70 | |
71 | =head1 AUTHOR |
72 | |
73 | Stevan Little E<lt>stevan@iinteractive.comE<gt> |
74 | |
75 | =head1 COPYRIGHT AND LICENSE |
76 | |
99c62fb8 |
77 | Copyright 2007-2008 by Infinity Interactive, Inc. |
9a976497 |
78 | |
79 | L<http://www.iinteractive.com> |
80 | |
81 | This library is free software; you can redistribute it and/or modify |
82 | it under the same terms as Perl itself. |
83 | |
e993b282 |
84 | =cut |