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