[Catalyst-commits] r8166 - in Catalyst-Runtime/5.80/trunk: . lib/Catalyst t t/lib/TestApp/Model

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Mon Jul 28 21:39:01 BST 2008


Author: t0m
Date: 2008-07-28 21:39:00 +0100 (Mon, 28 Jul 2008)
New Revision: 8166

Modified:
   Catalyst-Runtime/5.80/trunk/Changes
   Catalyst-Runtime/5.80/trunk/Makefile.PL
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Model.pm
   Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Model/Foo.pm
   Catalyst-Runtime/5.80/trunk/t/unit_core_component_layers.t
Log:
Commit a failing test for components getting config from self. This is a showstopper regression IMO, so it is not TODO. Change around new to BUILDARGS in C::Component

Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes	2008-07-28 18:49:59 UTC (rev 8165)
+++ Catalyst-Runtime/5.80/trunk/Changes	2008-07-28 20:39:00 UTC (rev 8166)
@@ -3,6 +3,7 @@
 5.8000
         - Port to Moose
         - Added test for action stringify
+        - Added test for component instances getting $self->{value} from config.
 
 5.7013
         - Fix subdirs for scripts that run in subdirs more than one level deep.

Modified: Catalyst-Runtime/5.80/trunk/Makefile.PL
===================================================================
--- Catalyst-Runtime/5.80/trunk/Makefile.PL	2008-07-28 18:49:59 UTC (rev 8165)
+++ Catalyst-Runtime/5.80/trunk/Makefile.PL	2008-07-28 20:39:00 UTC (rev 8166)
@@ -7,7 +7,7 @@
 all_from 'lib/Catalyst/Runtime.pm';
 
 requires 'MooseX::Emulate::Class::Accessor::Fast';
-
+requires 'Moose' => '0.51';
 requires 'Carp';
 requires 'Class::Accessor::Fast';
 requires 'Class::Data::Inheritable';

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm	2008-07-28 18:49:59 UTC (rev 8165)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm	2008-07-28 20:39:00 UTC (rev 8166)
@@ -57,15 +57,16 @@
 __PACKAGE__->mk_classdata('_plugins');
 __PACKAGE__->mk_classdata('_config');
 
-around new => sub {
-    my ( $orig, $self) = @_;
-
+sub BUILDARGS {
+    my ($self) = @_;
+    
     # Temporary fix, some components does not pass context to constructor
     my $arguments = ( ref( $_[-1] ) eq 'HASH' ) ? $_[-1] : {};
 
     my $args =  $self->merge_config_hashes( $self->config, $arguments );
-    $self->$orig( $args );
-};
+    
+    return $args;
+}
 
 no Moose;
 

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Model.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Model.pm	2008-07-28 18:49:59 UTC (rev 8165)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Model.pm	2008-07-28 20:39:00 UTC (rev 8166)
@@ -5,9 +5,6 @@
 
 no Moose;
 
-#We can't immutablize anything that ISA Component just yet
-#__PACKAGE__->meta->make_immutable();
-
 =head1 NAME
 
 Catalyst::Model - Catalyst Model base class

Modified: Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Model/Foo.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Model/Foo.pm	2008-07-28 18:49:59 UTC (rev 8165)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Model/Foo.pm	2008-07-28 20:39:00 UTC (rev 8166)
@@ -5,8 +5,12 @@
 
 use base qw/ Catalyst::Model /;
 
+__PACKAGE__->config( 'quux' => 'chunkybacon' );
+
 sub model_foo_method { 1 }
 
+sub model_quux_method { shift->{quux} }
+
 package TestApp::Model::Foo::Bar;
 sub model_foo_bar_method_from_foo { 1 }
 

Modified: Catalyst-Runtime/5.80/trunk/t/unit_core_component_layers.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/unit_core_component_layers.t	2008-07-28 18:49:59 UTC (rev 8165)
+++ Catalyst-Runtime/5.80/trunk/t/unit_core_component_layers.t	2008-07-28 20:39:00 UTC (rev 8166)
@@ -1,4 +1,4 @@
-use Test::More tests => 5;
+use Test::More tests => 6;
 use strict;
 use warnings;
 use lib 't/lib';
@@ -19,3 +19,8 @@
 
 can_ok($model_foo_bar, 'model_foo_bar_method_from_foo');
 can_ok($model_foo_bar, 'model_foo_bar_method_from_foo_bar');
+
+TestApp->setup;
+
+is($model_foo->model_quux_method, 'chunkybacon', 'Model method getting $self->{quux} from config');
+




More information about the Catalyst-commits mailing list