still failing some tests. waiting for suggestions on whether to fix old CDIretardedness
[catagits/Catalyst-Runtime.git] / lib / Catalyst / AttrContainer.pm
CommitLineData
ba599d1c 1package Catalyst::AttrContainer;
2
e7dc25cd 3use Moose;
ba599d1c 4use Catalyst::Exception;
ba599d1c 5
a7caa492 6with 'Catalyst::ClassData';
76aab993 7use Scalar::Util 'blessed';
e7dc25cd 8
0fc2d522 9no 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)
16sub 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
24sub FETCH_CODE_ATTRIBUTES { $_[0]->_attr_cache->{ $_[1] } || () }
25
26=head1 NAME
27
28Catalyst::AttrContainer
29
30=head1 SYNOPSIS
31
32=head1 DESCRIPTION
33
ac5c933b 34This class sets up the code attribute cache. It's a base class for
a1e61a69 35L<Catalyst::Controller>.
649fd1fa 36
ba599d1c 37=head1 METHODS
38
b5ecfcf0 39=head2 FETCH_CODE_ATTRIBUTES
ba599d1c 40
649fd1fa 41Attribute function. See attributes(3pm)
42
b5ecfcf0 43=head2 MODIFY_CODE_ATTRIBUTES
ba599d1c 44
649fd1fa 45Attribute function. See attributes(3pm)
46
ba599d1c 47=head1 SEE ALSO
48
a1e61a69 49L<Catalyst::Dispatcher>
ba599d1c 50L<Catalyst>.
51
52=head1 AUTHOR
53
54Sebastian Riedel, C<sri@cpan.org>
55Marcus Ramberg, C<mramberg@cpan.org>
56
57=head1 COPYRIGHT
58
59This program is free software, you can redistribute it and/or modify it under
60the same terms as Perl itself.
61
62=cut
63
641;