package MooseX::AttributeHelpers::Collection::Bag;
use Moose;
use Moose::Util::TypeConstraints;
+use MooseX::AttributeHelpers::Sugar;
our $VERSION = '0.01';
our $AUTHORITY = 'cpan:STEVAN';
-use MooseX::AttributeHelpers::MethodProvider::Bag;
-
extends 'MooseX::AttributeHelpers::Collection';
-has '+method_provider' => (
- default => 'MooseX::AttributeHelpers::MethodProvider::Bag'
-);
-
subtype 'Bag' => as 'HashRef[Int]';
-sub helper_type { 'Bag' }
-
-before 'process_options_for_provides' => sub {
- my ($self, $options, $name) = @_;
-
- # Set some default attribute options here unless already defined
- if ((my $type = $self->helper_type) && !exists $options->{isa}){
- $options->{isa} = $type;
- }
-
- $options->{default} = sub { +{} } unless exists $options->{default};
-};
+define_attribute_helper (
+ default_options => { default => sub { {} } },
+ helper_type => 'Bag',
+ method_provider => 'MooseX::AttributeHelpers::MethodProvider::Bag',
+ shortcut => 'Collection::Bag',
+);
no Moose;
no Moose::Util::TypeConstraints;
-
-# register the alias ...
-package # hide me from search.cpan.org
- Moose::Meta::Attribute::Custom::Collection::Bag;
-sub register_implementation { 'MooseX::AttributeHelpers::Collection::Bag' }
+no MooseX::AttributeHelpers::Sugar;
1;
bag-like operations. See L<MooseX::AttributeHelpers::MethodProvider::Bag>
for more details.
-=head1 METHODS
-
-=over 4
-
-=item B<meta>
-
-=item B<method_provider>
-
-=item B<has_method_provider>
-
-=item B<helper_type>
-
-=item B<process_options_for_provides>
+=head1 PROVIDED METHODS
-=back
+The methods for this metaclass are provided by
+L<MooseX::AttributeHelpers::MethodProvider::Bag>.
=head1 BUGS
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
-=cut
\ No newline at end of file
+=cut