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