reapplying changes by konobi that I accidentally undid earlier. sorry about that
[catagits/Catalyst-Runtime.git] / lib / Catalyst / AttrContainer.pm
CommitLineData
ba599d1c 1package Catalyst::AttrContainer;
2
e7dc25cd 3use Moose;
4#use strict;
5#use base qw/Class::Accessor::Fast Class::Data::Inheritable/;
e8b9f2a9 6
ba599d1c 7use Catalyst::Exception;
e8b9f2a9 8use NEXT;
ba599d1c 9
e7dc25cd 10#dont want to ISA a C::D::I
11use 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)
22sub 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
30sub FETCH_CODE_ATTRIBUTES { $_[0]->_attr_cache->{ $_[1] } || () }
31
32=head1 NAME
33
34Catalyst::AttrContainer
35
36=head1 SYNOPSIS
37
38=head1 DESCRIPTION
39
e7dc25cd 40This class sets up the code attribute cache. It's a base class for
a1e61a69 41L<Catalyst::Controller>.
649fd1fa 42
ba599d1c 43=head1 METHODS
44
b5ecfcf0 45=head2 FETCH_CODE_ATTRIBUTES
ba599d1c 46
649fd1fa 47Attribute function. See attributes(3pm)
48
b5ecfcf0 49=head2 MODIFY_CODE_ATTRIBUTES
ba599d1c 50
649fd1fa 51Attribute function. See attributes(3pm)
52
ba599d1c 53=head1 SEE ALSO
54
a1e61a69 55L<Catalyst::Dispatcher>
ba599d1c 56L<Catalyst>.
57
58=head1 AUTHOR
59
60Sebastian Riedel, C<sri@cpan.org>
61Marcus Ramberg, C<mramberg@cpan.org>
62
63=head1 COPYRIGHT
64
65This program is free software, you can redistribute it and/or modify it under
66the same terms as Perl itself.
67
68=cut
69
701;