[Catalyst-commits] r10646 - in Catalyst-Runtime/5.80/branches/index_default_fuckage: . lib/Catalyst t t/aggregate t/lib/TestApp t/lib/TestApp/Model

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Thu Jun 25 00:47:46 GMT 2009


Author: caelum
Date: 2009-06-25 00:47:45 +0000 (Thu, 25 Jun 2009)
New Revision: 10646

Added:
   Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestApp/Model.pm
   Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestApp/Model/ClosuresInConfig.pm
Removed:
   Catalyst-Runtime/5.80/branches/index_default_fuckage/t/path_escape_bug.t
Modified:
   Catalyst-Runtime/5.80/branches/index_default_fuckage/
   Catalyst-Runtime/5.80/branches/index_default_fuckage/Changes
   Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/Component.pm
   Catalyst-Runtime/5.80/branches/index_default_fuckage/t/aggregate/unit_core_uri_for_action.t
Log:
 r5600 at hlagh (orig r10609):  zarquon | 2009-06-20 17:31:39 -0700
 this test is not for the regression which you seek
 r5670 at hlagh (orig r10612):  t0m | 2009-06-22 09:31:09 -0700
 Test closures in config in the testapp. Makes everything go bang.
 r5671 at hlagh (orig r10613):  t0m | 2009-06-22 09:37:26 -0700
 Use merge_hashes rather than dclone
 r5672 at hlagh (orig r10614):  t0m | 2009-06-22 11:06:48 -0700
 Fix uri_for_action test by just reverting to as it was in 5.8003 before various lame tests were added and mismerged



Property changes on: Catalyst-Runtime/5.80/branches/index_default_fuckage
___________________________________________________________________
Name: svk:merge
   - 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/compres:7999
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/context_go:8001
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:8533
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/Catalyst-Test-Updates:8363
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/add_captures_to_visit:9546
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7911
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/trunk:10606
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
8a9521aa-ff93-41d6-9f87-b05cafcdab40:/local/cat/Catalyst-Runtime/5.80/trunk:8157
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
   + 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/compres:7999
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/context_go:8001
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:8533
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/Catalyst-Test-Updates:8363
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/add_captures_to_visit:9546
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7911
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/trunk:10614
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
8a9521aa-ff93-41d6-9f87-b05cafcdab40:/local/cat/Catalyst-Runtime/5.80/trunk:8157
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442

Modified: Catalyst-Runtime/5.80/branches/index_default_fuckage/Changes
===================================================================
--- Catalyst-Runtime/5.80/branches/index_default_fuckage/Changes	2009-06-25 00:41:38 UTC (rev 10645)
+++ Catalyst-Runtime/5.80/branches/index_default_fuckage/Changes	2009-06-25 00:47:45 UTC (rev 10646)
@@ -6,6 +6,10 @@
            applications.
         -  Remove use of Test::MockObject as it doesn't install from CPAN
            in some environments.
+        -  Remove use of dclone to deep copy configs and replace with
+           Catalyst::Utils::merge_hashes which has the same effect, of
+           ensuring child classes don't inherit their parent's config,
+           except works correctly with closures.
 
 5.80005 2009-06-06 14:40:00
 

Modified: Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/Component.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/Component.pm	2009-06-25 00:41:38 UTC (rev 10645)
+++ Catalyst-Runtime/5.80/branches/index_default_fuckage/lib/Catalyst/Component.pm	2009-06-25 00:47:45 UTC (rev 10646)
@@ -8,7 +8,6 @@
 use MRO::Compat;
 use mro 'c3';
 use Scalar::Util 'blessed';
-use Storable 'dclone';
 use namespace::clean -except => 'meta';
 
 with 'MooseX::Emulate::Class::Accessor::Fast';
@@ -117,7 +116,9 @@
         my $class = blessed($self) || $self;
         my $meta = Class::MOP::get_metaclass_by_name($class);
         unless ($meta->has_package_symbol('$_config')) {
-            $self->_config( dclone $config );
+            # Call merge_hashes to ensure we deep copy the parent
+            # config onto the subclass
+            $self->_config( Catalyst::Utils::merge_hashes($config, {}) );
         }
     }
     return $self->_config;

Modified: Catalyst-Runtime/5.80/branches/index_default_fuckage/t/aggregate/unit_core_uri_for_action.t
===================================================================
--- Catalyst-Runtime/5.80/branches/index_default_fuckage/t/aggregate/unit_core_uri_for_action.t	2009-06-25 00:41:38 UTC (rev 10645)
+++ Catalyst-Runtime/5.80/branches/index_default_fuckage/t/aggregate/unit_core_uri_for_action.t	2009-06-25 00:47:45 UTC (rev 10646)
@@ -8,7 +8,7 @@
 
 use Test::More;
 
-plan tests => 30;
+plan tests => 29;
 
 use_ok('TestApp');
 
@@ -160,10 +160,6 @@
         'http://127.0.0.1/foo/chained/foo2/1/2/end2/3/',
         'uri_for_action returns uri with empty arg on undef last argument' );
 
-    is( $context->uri_for_action($action_needs_two, [ 'foo' , 'bar/baz' ], (3,'')),
-        'http://127.0.0.1/foo/chained/foo2/foo/bar%2Fbaz/end2/3/',
-        'uri_for_action returns uri with empty arg on undef last argument' );
-
     my $complex_chained = '/action/chained/empty_chain_f';
     is( $context->uri_for_action( $complex_chained, [23], (13), {q => 3} ),
         'http://127.0.0.1/foo/chained/empty/23/13?q=3',

Added: Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestApp/Model/ClosuresInConfig.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestApp/Model/ClosuresInConfig.pm	                        (rev 0)
+++ Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestApp/Model/ClosuresInConfig.pm	2009-06-25 00:47:45 UTC (rev 10646)
@@ -0,0 +1,12 @@
+package TestApp::Model::ClosuresInConfig;
+use Moose;
+use namespace::clean -except => 'meta';
+
+extends 'TestApp::Model';
+
+# Note - don't call ->config in here until the constructor calls it to
+#        retrieve config, so that we get the 'copy from parent' path, 
+#        and ergo break due to the closure if dclone is used there..
+
+__PACKAGE__->meta->make_immutable;
+

Added: Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestApp/Model.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestApp/Model.pm	                        (rev 0)
+++ Catalyst-Runtime/5.80/branches/index_default_fuckage/t/lib/TestApp/Model.pm	2009-06-25 00:47:45 UTC (rev 10646)
@@ -0,0 +1,16 @@
+package TestApp::Model;
+use Moose;
+use namespace::clean -except => 'meta';
+
+extends 'Catalyst::Model';
+
+# Test a closure here, r10394 made this blow up when we clone the config down
+# onto the subclass..
+__PACKAGE__->config(
+    escape_flags => {
+        'js' => sub { ${ $_[0] } =~ s/\'/\\\'/g; },
+    }
+);
+
+__PACKAGE__->meta->make_immutable;
+

Deleted: Catalyst-Runtime/5.80/branches/index_default_fuckage/t/path_escape_bug.t
===================================================================
--- Catalyst-Runtime/5.80/branches/index_default_fuckage/t/path_escape_bug.t	2009-06-25 00:41:38 UTC (rev 10645)
+++ Catalyst-Runtime/5.80/branches/index_default_fuckage/t/path_escape_bug.t	2009-06-25 00:47:45 UTC (rev 10646)
@@ -1,37 +0,0 @@
-#!/usr/bin/env perl
-use warnings;
-use strict;
-use Test::More qw/no_plan/;
-
-{
-    package TestApp;
-    use parent qw/Catalyst/;
-    use parent qw/Catalyst::Controller/;
-    __PACKAGE__->setup();
-
-    sub thing :Path {
-        my ($self, $c, @path) = @_;
-        $c->res->body(join "/", @path);
-    }
-    sub another :Path('something') {
-        my ($self, $c) = @_;
-        $c->forward('thing');
-    }
-    sub thing_uri :Path('thing_uri') {
-        my ($self, $c, @path) = @_;
-        $c->res->body($c->uri_for(@path));
-    }
-}
-
-use_ok "Catalyst::Test", "TestApp";
-my $req_path = 'foo/bar/baz quoxx{fnord}';
-my $req = request("/$req_path");
-ok($req->is_success, 'request succeeds');
-is($req->content, $req_path, "returned path is identical to received path");
-$req = request("/something/$req_path");
-ok($req->is_success, 'request succeeds');
-is($req->content, $req_path, "returned path is identical to received path 2");
-$req = request("/thing_uri/$req_path");
-ok($req->is_success, 'request succeeds');
-is($req->content, "http://localhost/$req_path", "returned path is identical to received path 2");
-




More information about the Catalyst-commits mailing list