typo
[catagits/Catalyst-Runtime.git] / lib / Catalyst / AttrContainer.pm
CommitLineData
ba599d1c 1package Catalyst::AttrContainer;
2
4cfa1efa 3use Moose;
4use MooseX::ClassAttribute;
ba599d1c 5use Catalyst::Exception;
ba599d1c 6
4cfa1efa 7class_has _attr_cache => (
8 is => 'rw',
9 isa => 'HashRef',
10 required => 1,
11 default => sub{{}}
12 );
f1634af6 13class_has _action_cache => (
14 is => 'rw',
15 isa => 'ArrayRef',
16 required => 1,
17 default => sub{ [] }
4cfa1efa 18 );
ba599d1c 19
20# note - see attributes(3pm)
21sub MODIFY_CODE_ATTRIBUTES {
22 my ( $class, $code, @attrs ) = @_;
4cfa1efa 23 #can't the below just be $class->_attr_cache->{$code} = \@attrs; ?
57e45928 24 $class->_attr_cache( { %{ $class->_attr_cache }, $code => [@attrs] } );
4cfa1efa 25 #why can't this just be push @{$class->_action_cache}, [$code, \@attrs] ?
57e45928 26 $class->_action_cache(
27 [ @{ $class->_action_cache }, [ $code, [@attrs] ] ] );
ba599d1c 28 return ();
29}
30
31sub FETCH_CODE_ATTRIBUTES { $_[0]->_attr_cache->{ $_[1] } || () }
32
33=head1 NAME
34
35Catalyst::AttrContainer
36
37=head1 SYNOPSIS
38
39=head1 DESCRIPTION
40
4cfa1efa 41This class sets up the code attribute cache. It's a base class for
a1e61a69 42L<Catalyst::Controller>.
649fd1fa 43
ba599d1c 44=head1 METHODS
45
b5ecfcf0 46=head2 FETCH_CODE_ATTRIBUTES
ba599d1c 47
649fd1fa 48Attribute function. See attributes(3pm)
49
b5ecfcf0 50=head2 MODIFY_CODE_ATTRIBUTES
ba599d1c 51
649fd1fa 52Attribute function. See attributes(3pm)
53
ba599d1c 54=head1 SEE ALSO
55
a1e61a69 56L<Catalyst::Dispatcher>
ba599d1c 57L<Catalyst>.
58
59=head1 AUTHOR
60
61Sebastian Riedel, C<sri@cpan.org>
62Marcus Ramberg, C<mramberg@cpan.org>
63
64=head1 COPYRIGHT
65
66This program is free software, you can redistribute it and/or modify it under
67the same terms as Perl itself.
68
69=cut
70
711;