2 package MooseX::AttributeHelpers::Base;
6 our $AUTHORITY = 'cpan:STEVAN';
8 extends 'Moose::Meta::Attribute';
10 has 'method_constructors' => (
22 has '+$!default' => (required => 1);
23 has '+type_constraint' => (required => 1);
26 my ($self, $provides) = @_;
27 my $method_constructors = $self->method_constructors;
28 foreach my $key (keys %$provides) {
29 (exists $method_constructors->{$key})
30 || confess "$key is an unsupported method type";
34 sub _process_options_for_provides {
35 my ($self, $options) = @_;
39 before '_process_options' => sub {
40 my ($self, %options) = @_;
42 if (exists $options{provides}) {
43 $self->_check_provides($options{provides});
44 $self->_process_options_for_provides(\%options);
48 after 'install_accessors' => sub {
50 my $class = $attr->associated_class;
52 my $method_constructors = $attr->method_constructors;
54 foreach my $key (keys %{$attr->provides}) {
56 $attr->provides->{$key},
57 $method_constructors->{$key}->($attr)
63 no Moose::Util::TypeConstraints;
74 MooseX::AttributeHelpers::Base
84 All complex software has bugs lurking in it, and this module is no
85 exception. If you find a bug please either email me, or add the bug
90 Stevan Little E<lt>stevan@iinteractive.comE<gt>
92 =head1 COPYRIGHT AND LICENSE
94 Copyright 2007 by Infinity Interactive, Inc.
96 L<http://www.iinteractive.com>
98 This library is free software; you can redistribute it and/or modify
99 it under the same terms as Perl itself.