Hmm. I think I did something odd in here...
[gitmo/MooseX-AttributeHelpers.git] / lib / MooseX / AttributeHelpers / Collection / Bag.pm
CommitLineData
9a976497 1
2package MooseX::AttributeHelpers::Collection::Bag;
3use Moose;
4use Moose::Util::TypeConstraints;
e993b282 5use MooseX::AttributeHelpers::Sugar;
9a976497 6
7our $VERSION = '0.01';
8our $AUTHORITY = 'cpan:STEVAN';
9
9a976497 10extends 'MooseX::AttributeHelpers::Collection';
11
9a976497 12subtype 'Bag' => as 'HashRef[Int]';
13
e993b282 14define_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
21no Moose;
22no Moose::Util::TypeConstraints;
e993b282 23no MooseX::AttributeHelpers::Sugar;
9a976497 24
251;
26
27__END__
28
29=pod
30
31=head1 NAME
32
33MooseX::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
56This module provides a Bag attribute which provides a number of
57bag-like operations. See L<MooseX::AttributeHelpers::MethodProvider::Bag>
58for more details.
59
e993b282 60=head1 PROVIDED METHODS
9a976497 61
e993b282 62The methods for this metaclass are provided by
63L<MooseX::AttributeHelpers::MethodProvider::Bag>.
9a976497 64
65=head1 BUGS
66
67All complex software has bugs lurking in it, and this module is no
68exception. If you find a bug please either email me, or add the bug
69to cpan-RT.
70
71=head1 AUTHOR
72
73Stevan Little E<lt>stevan@iinteractive.comE<gt>
74
75=head1 COPYRIGHT AND LICENSE
76
99c62fb8 77Copyright 2007-2008 by Infinity Interactive, Inc.
9a976497 78
79L<http://www.iinteractive.com>
80
81This library is free software; you can redistribute it and/or modify
82it under the same terms as Perl itself.
83
e993b282 84=cut