From: Guillermo Roditi Date: Mon, 23 Jun 2008 20:58:30 +0000 (+0000) Subject: AttrContainer and additional dep for it X-Git-Tag: 5.8000_03~130 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=4cfa1efab08273928363729c3843f18a3a66a4c4 AttrContainer and additional dep for it r16972@martha (orig r7495): groditi | 2008-03-14 18:25:44 -0400 --- diff --git a/Makefile.PL b/Makefile.PL index ab5e7c6..d183865 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,11 +1,15 @@ use inc::Module::Install 0.64; -use 5.008001; +use 5.008001; perl_version '5.8.1'; name 'Catalyst-Runtime'; all_from 'lib/Catalyst/Runtime.pm'; +#from Moose port: +requires 'Moose'; #version tbd. +requires 'MooseX::ClassAttribute'; #version tbd + requires 'perl' => '5.8.1'; requires 'Carp'; requires 'Class::Accessor::Fast'; @@ -38,7 +42,7 @@ if (-e 'inc/.author') { build_requires 'Test::Pod' => 1.14; build_requires 'Test::Pod::Coverage' => 1.04; - if ($^O eq 'darwin') { + if ($^O eq 'darwin') { my $osx_ver = `/usr/bin/sw_vers -productVersion`; chomp $osx_ver; @@ -48,7 +52,7 @@ if (-e 'inc/.author') { makemaker_args(dist => { PREOP => qq{\@if [ "\$\$$attr" != "true" ]; then}. qq{ echo "You must set the ENV variable $attr to true,"; }. - ' echo "to avoid getting resource forks in your dist."; exit 255; fi' }); + ' echo "to avoid getting resource forks in your dist."; exit 255; fi' }); } } @@ -68,7 +72,7 @@ print <<"EOF"; perl -MCPANPLUS -e 'install Catalyst::Devel' # or perl -MCPAN -e 'install Catalyst::Devel' - To get some commonly used plugins, as well as the TT view and DBIC + To get some commonly used plugins, as well as the TT view and DBIC model, install Task::Catalyst in the same way. Have fun! diff --git a/lib/Catalyst/AttrContainer.pm b/lib/Catalyst/AttrContainer.pm index a33d822..dae87dc 100644 --- a/lib/Catalyst/AttrContainer.pm +++ b/lib/Catalyst/AttrContainer.pm @@ -1,19 +1,28 @@ package Catalyst::AttrContainer; -use strict; -use base qw/Class::Accessor::Fast Class::Data::Inheritable/; - +use Moose; +use MooseX::ClassAttribute; use Catalyst::Exception; -use NEXT; -__PACKAGE__->mk_classdata($_) for qw/_attr_cache _action_cache/; -__PACKAGE__->_attr_cache( {} ); -__PACKAGE__->_action_cache( [] ); +class_has _attr_cache => ( + is => 'rw', + isa => 'HashRef', + required => 1, + default => sub{{}} + ); +clas_has _action_cache => ( + is => 'rw', + isa => 'ArrayRef', + required => 1, + default => sub{ [] } + ); # 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 (); @@ -29,7 +38,7 @@ Catalyst::AttrContainer =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