X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FAttrContainer.pm;h=921a886931aecfad3fa448db86273272d397245e;hb=213cf5bba2c5d308357e07a6041fc01a9519b6e2;hp=31178249f31483edfad77e89a9b2e3331d1cfeaf;hpb=6323fda2e7ace0fc0aa06305c674957cedc6d025;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/AttrContainer.pm b/lib/Catalyst/AttrContainer.pm index 3117824..921a886 100644 --- a/lib/Catalyst/AttrContainer.pm +++ b/lib/Catalyst/AttrContainer.pm @@ -1,36 +1,19 @@ package Catalyst::AttrContainer; use Moose; -#use MooseX::ClassAttribute; use Catalyst::Exception; -use Class::Data::Inheritable; -{ - my $mk_classdata = Class::Data::Inheritable->can('mk_classdata'); - __PACKAGE__->meta->add_method(mk_classdata => $mk_classdata); -} +use Scalar::Util 'blessed'; +with 'Catalyst::ClassData'; + +no Moose; -__PACKAGE__->mk_classdata(_attr_cache => {}); -__PACKAGE__->mk_classdata(_action_cache => []); - -# class_has _attr_cache => ( -# is => 'rw', -# isa => 'HashRef', -# required => 1, -# default => sub{{}} -# ); -# class_has _action_cache => ( -# is => 'rw', -# isa => 'ArrayRef', -# required => 1, -# default => sub{ [] } -# ); +__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 (); @@ -40,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. =head1 METHODS @@ -64,10 +47,9 @@ Attribute function. See attributes(3pm) L L. -=head1 AUTHOR +=head1 AUTHORS -Sebastian Riedel, C -Marcus Ramberg, C +Catalyst Contributors, see Catalyst.pm =head1 COPYRIGHT