2 package MooseX::AttributeHelpers::Collection::Array;
6 our $AUTHORITY = 'cpan:STEVAN';
8 extends 'MooseX::AttributeHelpers::Base';
10 sub helper_type { 'ArrayRef' }
12 has '+method_constructors' => (
19 push @{$attr->get_value($instance)} => @_;
24 return sub { pop @{$attr->get_value($_[0])} };
30 unshift @{$attr->get_value($instance)} => @_;
35 return sub { shift @{$attr->get_value($_[0])} };
39 return sub { $attr->get_value($_[0])->[$_[1]] };
43 return sub { $attr->get_value($_[0])->[$_[1]] = $_[2] };
47 return sub { scalar @{$attr->get_value($_[0])} };
51 return sub { scalar @{$attr->get_value($_[0])} ? 1 : 0 };
59 # register the alias ...
60 package Moose::Meta::Attribute::Custom::Collection::Array;
61 sub register_implementation { 'MooseX::AttributeHelpers::Collection::Array' }
78 metaclass => 'Collection',
81 default => sub { [] },
83 'push' => 'add_options',
84 'pop' => 'remove_last_option',
94 All complex software has bugs lurking in it, and this module is no
95 exception. If you find a bug please either email me, or add the bug
100 Stevan Little E<lt>stevan@iinteractive.comE<gt>
102 =head1 COPYRIGHT AND LICENSE
104 Copyright 2007 by Infinity Interactive, Inc.
106 L<http://www.iinteractive.com>
108 This library is free software; you can redistribute it and/or modify
109 it under the same terms as Perl itself.