- Turned action registration inside-out
[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 ) = @_;
91d4abc5 16 $class->_attr_cache({ %{$class->_attr_cache}, $code => [@attrs] });
17 $class->_action_cache([ @{$class->_action_cache}, [ $code, [@attrs] ] ]);
ba599d1c 18 return ();
19}
20
21sub FETCH_CODE_ATTRIBUTES { $_[0]->_attr_cache->{ $_[1] } || () }
22
23=head1 NAME
24
25Catalyst::AttrContainer
26
27=head1 SYNOPSIS
28
29=head1 DESCRIPTION
30
31=head1 METHODS
32
33=over 4
34
35=item FETCH_CODE_ATTRIBUTES
36
37=item MODIFY_CODE_ATTRIBUTES
38
39=back
40
41=head1 SEE ALSO
42
43L<Catalyst>.
44
45=head1 AUTHOR
46
47Sebastian Riedel, C<sri@cpan.org>
48Marcus Ramberg, C<mramberg@cpan.org>
49
50=head1 COPYRIGHT
51
52This program is free software, you can redistribute it and/or modify it under
53the same terms as Perl itself.
54
55=cut
56
571;