1 package MooseX::MethodAttributes::Role::Meta::Map;
4 # ABSTRACT: generic role for storing code attributes used by classes and roles with attributes
7 use MooseX::Types::Moose qw/HashRef ArrayRef Str Int/;
9 use namespace::clean -except => 'meta';
11 has _method_attribute_map => (
13 isa => HashRef[ArrayRef[Str]],
15 default => sub { +{} },
18 has _method_attribute_list => (
22 default => sub { [] },
26 sub register_method_attributes {
27 my ($self, $code, $attrs) = @_;
28 push @{ $self->_method_attribute_list }, 0 + $code;
29 $self->_method_attribute_map->{ 0 + $code } = $attrs;
34 sub get_method_attributes {
35 my ($self, $code) = @_;
36 return $self->_method_attribute_map->{ 0 + $code } || [];
48 MooseX::MethodAttributes::Role::Meta::Map - generic role for storing code attributes used by classes and roles with attributes
56 =head2 register_method_attributes ($code, $attrs)
58 Register a list of attributes for a code reference.
62 =head2 get_method_attributes ($code)
64 Get a list of attributes associated with a coderef.
70 Florian Ragwitz <rafl@debian.org>
71 Tomas Doran <bobtfish@bobtfish.net>
73 =head1 COPYRIGHT AND LICENSE
75 This software is copyright (c) 2009 by Florian Ragwitz.
77 This is free software; you can redistribute it and/or modify it under
78 the same terms as perl itself.