Fixed attrcontainer to ignore lvalue methods
[catagits/Catalyst-Runtime.git] / lib / Catalyst / AttrContainer.pm
CommitLineData
ba599d1c 1package Catalyst::AttrContainer;
2
3use strict;
4use base qw/Class::Data::Inheritable Class::Accessor::Fast/;
5
6use Catalyst::Exception;
7use NEXT;
8
9__PACKAGE__->mk_classdata($_) for qw/_attr_cache _action_cache/;
10__PACKAGE__->_attr_cache( {} );
11__PACKAGE__->_action_cache( [] );
12
13# note - see attributes(3pm)
14sub MODIFY_CODE_ATTRIBUTES {
15 my ( $class, $code, @attrs ) = @_;
97e14a03 16 return if ( ( $attrs[0] eq 'lvalue' ) && ( @attrs == 1 ) );
57e45928 17 $class->_attr_cache( { %{ $class->_attr_cache }, $code => [@attrs] } );
18 $class->_action_cache(
19 [ @{ $class->_action_cache }, [ $code, [@attrs] ] ] );
ba599d1c 20 return ();
21}
22
23sub FETCH_CODE_ATTRIBUTES { $_[0]->_attr_cache->{ $_[1] } || () }
24
25=head1 NAME
26
27Catalyst::AttrContainer
28
29=head1 SYNOPSIS
30
31=head1 DESCRIPTION
32
33=head1 METHODS
34
35=over 4
36
37=item FETCH_CODE_ATTRIBUTES
38
39=item MODIFY_CODE_ATTRIBUTES
40
41=back
42
43=head1 SEE ALSO
44
45L<Catalyst>.
46
47=head1 AUTHOR
48
49Sebastian Riedel, C<sri@cpan.org>
50Marcus Ramberg, C<mramberg@cpan.org>
51
52=head1 COPYRIGHT
53
54This program is free software, you can redistribute it and/or modify it under
55the same terms as Perl itself.
56
57=cut
58
591;