d1c57e017635634d7e467cb542ef14fd5c5d48eb
[gitmo/MooseX-AttributeHelpers.git] / lib / MooseX / AttributeHelpers / Trait / Collection / Array.pm
1
2 package MooseX::AttributeHelpers::Trait::Collection::Array;
3 use Moose::Role;
4
5 our $VERSION   = '0.01';
6 our $AUTHORITY = 'cpan:STEVAN';
7
8 use MooseX::AttributeHelpers::MethodProvider::Array;
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::Array'
17 );
18
19 sub helper_type { 'ArrayRef' }
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::Array;
26 sub register_implementation {
27     'MooseX::AttributeHelpers::Trait::Collection::Array'
28 }
29
30
31 1;
32
33 __END__
34
35 =pod
36
37 =head1 NAME
38
39 MooseX::AttributeHelpers::Collection::Array
40
41 =head1 SYNOPSIS
42
43   package Stuff;
44   use Moose;
45   use MooseX::AttributeHelpers;
46   
47   has 'options' => (
48       metaclass => 'Collection::Array',
49       is        => 'ro',
50       isa       => 'ArrayRef[Int]',
51       default   => sub { [] },
52       provides  => {
53           'push' => 'add_options',
54           'pop'  => 'remove_last_option',
55       }
56   );
57
58 =head1 DESCRIPTION
59
60 This module provides an Array attribute which provides a number of 
61 array operations. See L<MooseX::AttributeHelpers::MethodProvider::Array>
62 for more details.
63
64 =head1 METHODS
65
66 =over 4
67
68 =item B<meta>
69
70 =item B<method_provider>
71
72 =item B<has_method_provider>
73
74 =item B<helper_type>
75
76 =back
77
78 =head1 BUGS
79
80 All complex software has bugs lurking in it, and this module is no 
81 exception. If you find a bug please either email me, or add the bug
82 to cpan-RT.
83
84 =head1 AUTHOR
85
86 Stevan Little E<lt>stevan@iinteractive.comE<gt>
87
88 =head1 COPYRIGHT AND LICENSE
89
90 Copyright 2007-2008 by Infinity Interactive, Inc.
91
92 L<http://www.iinteractive.com>
93
94 This library is free software; you can redistribute it and/or modify
95 it under the same terms as Perl itself.
96
97 =cut
98