r12983@zaphod: kd | 2008-04-28 18:10:27 +1000
[catagits/Catalyst-Runtime.git] / lib / Catalyst / AttrContainer.pm
index dae87dc..921a886 100644 (file)
@@ -1,28 +1,19 @@
 package Catalyst::AttrContainer;
 
 use Moose;
-use MooseX::ClassAttribute;
 use Catalyst::Exception;
+use Scalar::Util 'blessed';
+with 'Catalyst::ClassData';
 
-class_has _attr_cache   => (
-                            is => 'rw',
-                            isa => 'HashRef',
-                            required => 1,
-                            default => sub{{}}
-                           );
-clas_has _action_cache => (
-                           is => 'rw',
-                           isa => 'ArrayRef',
-                           required => 1,
-                           default => sub{ [] }
-                          );
+no Moose;
+
+__PACKAGE__->mk_classdata(_attr_cache => {} );
+__PACKAGE__->mk_classdata( _action_cache => [] );
 
 # note - see attributes(3pm)
 sub MODIFY_CODE_ATTRIBUTES {
     my ( $class, $code, @attrs ) = @_;
-    #can't the below just be $class->_attr_cache->{$code} = \@attrs; ?
     $class->_attr_cache( { %{ $class->_attr_cache }, $code => [@attrs] } );
-    #why can't this just be push @{$class->_action_cache}, [$code, \@attrs] ?
     $class->_action_cache(
         [ @{ $class->_action_cache }, [ $code, [@attrs] ] ] );
     return ();
@@ -32,13 +23,13 @@ sub FETCH_CODE_ATTRIBUTES { $_[0]->_attr_cache->{ $_[1] } || () }
 
 =head1 NAME
 
-Catalyst::AttrContainer
+Catalyst::AttrContainer - Handles code attribute storage and caching
 
 =head1 SYNOPSIS
 
 =head1 DESCRIPTION
 
-This class sets up the code attribute cache.  It's a base class for
+This class sets up the code attribute cache.  It's a base class for 
 L<Catalyst::Controller>.
 
 =head1 METHODS
@@ -56,10 +47,9 @@ Attribute function. See attributes(3pm)
 L<Catalyst::Dispatcher>
 L<Catalyst>.
 
-=head1 AUTHOR
+=head1 AUTHORS
 
-Sebastian Riedel, C<sri@cpan.org>
-Marcus Ramberg, C<mramberg@cpan.org>
+Catalyst Contributors, see Catalyst.pm
 
 =head1 COPYRIGHT