[Catalyst-commits] r7495 - in Catalyst-Runtime/5.80/branches/moose: . lib/Catalyst

groditi at dev.catalyst.perl.org groditi at dev.catalyst.perl.org
Fri Mar 14 22:25:45 GMT 2008


Author: groditi
Date: 2008-03-14 22:25:44 +0000 (Fri, 14 Mar 2008)
New Revision: 7495

Modified:
   Catalyst-Runtime/5.80/branches/moose/Makefile.PL
   Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/AttrContainer.pm
Log:
AttrContainer and additional dep for it

Modified: Catalyst-Runtime/5.80/branches/moose/Makefile.PL
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/Makefile.PL	2008-03-14 22:06:17 UTC (rev 7494)
+++ Catalyst-Runtime/5.80/branches/moose/Makefile.PL	2008-03-14 22:25:44 UTC (rev 7495)
@@ -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 @@
   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 @@
 
       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 @@
         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!

Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/AttrContainer.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/AttrContainer.pm	2008-03-14 22:06:17 UTC (rev 7494)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/AttrContainer.pm	2008-03-14 22:25:44 UTC (rev 7495)
@@ -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 @@
 
 =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




More information about the Catalyst-commits mailing list