Create branch register_actions.
[catagits/Catalyst-Runtime.git] / lib / Catalyst / AttrContainer.pm
CommitLineData
ba599d1c 1package Catalyst::AttrContainer;
2
ae29b412 3use Moose;
ba599d1c 4use Catalyst::Exception;
ae29b412 5with 'Catalyst::ClassData';
6
7no Moose;
ba599d1c 8
ae29b412 9__PACKAGE__->mk_classdata(_attr_cache => {} );
10__PACKAGE__->mk_classdata( _action_cache => [] );
ba599d1c 11
12# note - see attributes(3pm)
13sub MODIFY_CODE_ATTRIBUTES {
14 my ( $class, $code, @attrs ) = @_;
57e45928 15 $class->_attr_cache( { %{ $class->_attr_cache }, $code => [@attrs] } );
16 $class->_action_cache(
17 [ @{ $class->_action_cache }, [ $code, [@attrs] ] ] );
ba599d1c 18 return ();
19}
20
21sub FETCH_CODE_ATTRIBUTES { $_[0]->_attr_cache->{ $_[1] } || () }
22
23=head1 NAME
24
0bf7ab71 25Catalyst::AttrContainer - Handles code attribute storage and caching
ba599d1c 26
27=head1 SYNOPSIS
28
29=head1 DESCRIPTION
30
649fd1fa 31This class sets up the code attribute cache. It's a base class for
a1e61a69 32L<Catalyst::Controller>.
649fd1fa 33
ba599d1c 34=head1 METHODS
35
b5ecfcf0 36=head2 FETCH_CODE_ATTRIBUTES
ba599d1c 37
649fd1fa 38Attribute function. See attributes(3pm)
39
b5ecfcf0 40=head2 MODIFY_CODE_ATTRIBUTES
ba599d1c 41
649fd1fa 42Attribute function. See attributes(3pm)
43
ba599d1c 44=head1 SEE ALSO
45
a1e61a69 46L<Catalyst::Dispatcher>
ba599d1c 47L<Catalyst>.
48
0bf7ab71 49=head1 AUTHORS
ba599d1c 50
0bf7ab71 51Catalyst Contributors, see Catalyst.pm
ba599d1c 52
53=head1 COPYRIGHT
54
55This program is free software, you can redistribute it and/or modify it under
56the same terms as Perl itself.
57
58=cut
59
601;