AttrContainer no longer ISA C::D::I but still uses it until I figure what to do about...
[catagits/Catalyst-Runtime.git] / lib / Catalyst / AttrContainer.pm
1 package Catalyst::AttrContainer;
2
3 use Moose;
4 #use strict;
5 #use base qw/Class::Accessor::Fast Class::Data::Inheritable/;
6
7 use Catalyst::Exception;
8 use NEXT;
9
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
17 __PACKAGE__->mk_classdata($_) for qw/_attr_cache _action_cache/;
18 __PACKAGE__->_attr_cache( {} );
19 __PACKAGE__->_action_cache( [] );
20
21 # note - see attributes(3pm)
22 sub MODIFY_CODE_ATTRIBUTES {
23     my ( $class, $code, @attrs ) = @_;
24     $class->_attr_cache( { %{ $class->_attr_cache }, $code => [@attrs] } );
25     $class->_action_cache(
26         [ @{ $class->_action_cache }, [ $code, [@attrs] ] ] );
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
40 This class sets up the code attribute cache.  It's a base class for
41 L<Catalyst::Controller>.
42
43 =head1 METHODS
44
45 =head2 FETCH_CODE_ATTRIBUTES
46
47 Attribute function. See attributes(3pm)
48
49 =head2 MODIFY_CODE_ATTRIBUTES
50
51 Attribute function. See attributes(3pm)
52
53 =head1 SEE ALSO
54
55 L<Catalyst::Dispatcher>
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;