1 package Moose::Meta::Role::Application;
8 $VERSION = eval $VERSION;
9 our $AUTHORITY = 'cpan:STEVAN';
11 __PACKAGE__->meta->add_attribute('method_exclusions' => (
12 init_arg => '-excludes',
13 reader => 'get_method_exclusions',
17 __PACKAGE__->meta->add_attribute('method_aliases' => (
19 reader => 'get_method_aliases',
24 my ($class, %params) = @_;
25 $class->_new(\%params);
28 sub is_method_excluded {
29 my ($self, $method_name) = @_;
30 foreach (@{$self->get_method_exclusions}) {
31 return 1 if $_ eq $method_name;
36 sub is_method_aliased {
37 my ($self, $method_name) = @_;
38 exists $self->get_method_aliases->{$method_name} ? 1 : 0
41 sub is_aliased_method {
42 my ($self, $method_name) = @_;
43 my %aliased_names = reverse %{$self->get_method_aliases};
44 exists $aliased_names{$method_name} ? 1 : 0;
50 $self->check_role_exclusions(@_);
51 $self->check_required_methods(@_);
52 $self->check_required_attributes(@_);
54 $self->apply_attributes(@_);
55 $self->apply_methods(@_);
57 $self->apply_override_method_modifiers(@_);
59 $self->apply_before_method_modifiers(@_);
60 $self->apply_around_method_modifiers(@_);
61 $self->apply_after_method_modifiers(@_);
64 sub check_role_exclusions { Carp::croak "Abstract Method" }
65 sub check_required_methods { Carp::croak "Abstract Method" }
66 sub check_required_attributes { Carp::croak "Abstract Method" }
68 sub apply_attributes { Carp::croak "Abstract Method" }
69 sub apply_methods { Carp::croak "Abstract Method" }
70 sub apply_override_method_modifiers { Carp::croak "Abstract Method" }
71 sub apply_method_modifiers { Carp::croak "Abstract Method" }
73 sub apply_before_method_modifiers { (shift)->apply_method_modifiers('before' => @_) }
74 sub apply_around_method_modifiers { (shift)->apply_method_modifiers('around' => @_) }
75 sub apply_after_method_modifiers { (shift)->apply_method_modifiers('after' => @_) }
85 Moose::Meta::Role::Application - A base class for role application
89 This is the abstract base class for role applications.
91 The API for this class and its subclasses still needs some
92 consideration, and is intentionally not yet documented.
102 =item B<get_method_exclusions>
104 =item B<is_method_excluded>
106 =item B<get_method_aliases>
108 =item B<is_aliased_method>
110 =item B<is_method_aliased>
114 =item B<check_role_exclusions>
116 =item B<check_required_methods>
118 =item B<check_required_attributes>
120 =item B<apply_attributes>
122 =item B<apply_methods>
124 =item B<apply_method_modifiers>
126 =item B<apply_before_method_modifiers>
128 =item B<apply_after_method_modifiers>
130 =item B<apply_around_method_modifiers>
132 =item B<apply_override_method_modifiers>
138 See L<Moose/BUGS> for details on reporting bugs.
142 Stevan Little E<lt>stevan@iinteractive.comE<gt>
144 =head1 COPYRIGHT AND LICENSE
146 Copyright 2006-2010 by Infinity Interactive, Inc.
148 L<http://www.iinteractive.com>
150 This library is free software; you can redistribute it and/or modify
151 it under the same terms as Perl itself.