Commit | Line | Data |
---|---|---|
ba599d1c | 1 | package Catalyst::AttrContainer; |
2 | ||
e7dc25cd | 3 | use Moose; |
ba599d1c | 4 | use Catalyst::Exception; |
ba599d1c | 5 | |
a7caa492 | 6 | with 'Catalyst::ClassData'; |
76aab993 | 7 | use Scalar::Util 'blessed'; |
e7dc25cd | 8 | |
0fc2d522 | 9 | no Moose; |
10 | ||
e8b9f2a9 | 11 | __PACKAGE__->mk_classdata($_) for qw/_attr_cache _action_cache/; |
12 | __PACKAGE__->_attr_cache( {} ); | |
13 | __PACKAGE__->_action_cache( [] ); | |
ba599d1c | 14 | |
15 | # note - see attributes(3pm) | |
16 | sub MODIFY_CODE_ATTRIBUTES { | |
17 | my ( $class, $code, @attrs ) = @_; | |
57e45928 | 18 | $class->_attr_cache( { %{ $class->_attr_cache }, $code => [@attrs] } ); |
19 | $class->_action_cache( | |
20 | [ @{ $class->_action_cache }, [ $code, [@attrs] ] ] ); | |
ba599d1c | 21 | return (); |
22 | } | |
23 | ||
24 | sub FETCH_CODE_ATTRIBUTES { $_[0]->_attr_cache->{ $_[1] } || () } | |
25 | ||
26 | =head1 NAME | |
27 | ||
28 | Catalyst::AttrContainer | |
29 | ||
30 | =head1 SYNOPSIS | |
31 | ||
32 | =head1 DESCRIPTION | |
33 | ||
ac5c933b | 34 | This class sets up the code attribute cache. It's a base class for |
a1e61a69 | 35 | L<Catalyst::Controller>. |
649fd1fa | 36 | |
ba599d1c | 37 | =head1 METHODS |
38 | ||
b5ecfcf0 | 39 | =head2 FETCH_CODE_ATTRIBUTES |
ba599d1c | 40 | |
649fd1fa | 41 | Attribute function. See attributes(3pm) |
42 | ||
b5ecfcf0 | 43 | =head2 MODIFY_CODE_ATTRIBUTES |
ba599d1c | 44 | |
649fd1fa | 45 | Attribute function. See attributes(3pm) |
46 | ||
ba599d1c | 47 | =head1 SEE ALSO |
48 | ||
a1e61a69 | 49 | L<Catalyst::Dispatcher> |
ba599d1c | 50 | L<Catalyst>. |
51 | ||
52 | =head1 AUTHOR | |
53 | ||
54 | Sebastian Riedel, C<sri@cpan.org> | |
55 | Marcus Ramberg, C<mramberg@cpan.org> | |
56 | ||
57 | =head1 COPYRIGHT | |
58 | ||
59 | This program is free software, you can redistribute it and/or modify it under | |
60 | the same terms as Perl itself. | |
61 | ||
62 | =cut | |
63 | ||
64 | 1; |