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

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Mon Jun 22 16:31:09 GMT 2009


Author: t0m
Date: 2009-06-22 16:31:09 +0000 (Mon, 22 Jun 2009)
New Revision: 10612

Added:
   Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Model.pm
   Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Model/ClosuresInConfig.pm
Log:
Test closures in config in the testapp. Makes everything go bang.

Added: Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Model/ClosuresInConfig.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Model/ClosuresInConfig.pm	                        (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Model/ClosuresInConfig.pm	2009-06-22 16:31:09 UTC (rev 10612)
@@ -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/trunk/t/lib/TestApp/Model.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Model.pm	                        (rev 0)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Model.pm	2009-06-22 16:31:09 UTC (rev 10612)
@@ -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;
+




More information about the Catalyst-commits mailing list