some minor fixes
Robert 'phaylon' Sedlacek [Sun, 11 Oct 2009 17:50:45 +0000 (19:50 +0200)]
Changes
Makefile.PL
lib/CatalystX/Declare/Controller/ActionPreparation.pm
t/022_parameterized_roles.t
t/lib/TestApp/ControllerRole/Parameterized.pm

diff --git a/Changes b/Changes
index 7134ecd..b5292df 100644 (file)
--- a/Changes
+++ b/Changes
@@ -4,6 +4,9 @@
     - path parts and chain base actions are parameterizable
     - action names are parameterizable
     - fixed parameterized role target meta object bug
+    - dispatch type mutabilisation for manipulation now done more
+      sanely (Tomas Doran).
+    - fixed M:I requirement handling for authors.
 
 [0.010] Sun Sep 13 15:52:01 CEST 2009
     - Fix Compat with MooseX::Method::Signatures >=0.22 ( KENTNL )
index 621eb6c..1e0fa28 100644 (file)
@@ -1,10 +1,20 @@
 use inc::Module::Install;
 
-# required for authors:
-#   Module::Install::ProvidesClass >= 0.000001_99
-#   Module::Install::AutoManifest
-#   Module::Install::ReadmeFromPod
-#   Module::Install::AuthorTests
+BEGIN {
+    if ($Module::Install::AUTHOR) {
+
+        "Module::Install::$_"->can('can') 
+            or die "Module::Install extension Module::Install::$_ is required for authors"
+            for qw(
+                    AuthorTests
+                    AutoManifest
+                    ReadmeFromPod
+                    ProvidesClass
+            );
+
+        Module::Install::ProvidesClass->VERSION('0.000001_99');
+    }
+}
 
 name            'CatalystX-Declare';
 author          'Robert Sedlacek <rs@474.at>';
@@ -29,7 +39,7 @@ requires        'Moose',                            '0.89';
 requires        'MooseX::AttributeHelpers',         '0.21';
 requires        'MooseX::Declare',                  '0.30';
 requires        'MooseX::MethodAttributes',         '0.16';
-requires        'MooseX::Parameterized',            '0.13';
+requires        'MooseX::Role::Parameterized',      '0.13';
 requires        'MooseX::Types',                    '0.20';
 requires        'MooseX::Method::Signatures',       '0.26';
 requires        'FindBin';
index 720a9a7..16ad629 100644 (file)
@@ -34,12 +34,17 @@ role CatalystX::Declare::Controller::ActionPreparation {
         return
             if $type->DOES(ChainTypeSensitivity);
 
-        # FIXME this is ugly as hell
         my $immutable = $type->meta->is_immutable;
-        $type->meta->make_mutable
-            if $immutable;
+        my %immutable_options;
+        if ($immutable) {
+            %immutable_options = $type->meta->immutable_options;
+            $type->meta->make_mutable;
+        }
+
+        # FIXME we really shouldn't have to tweak the dispatch type
         ChainTypeSensitivity->meta->apply($type->meta);
-        $type->meta->make_immutable
+
+        $type->meta->make_immutable(%immutable_options)
             if $immutable;
     }
 
index 84874f7..796f182 100644 (file)
@@ -16,5 +16,6 @@ is get('/param/somebase/somepart/deep'), 'somepart/deep under somebase', 'more c
 is get('/param/somebase/someaction'), 'someaction action', 'dynamic action name';
 is get('/param/somebase/actionalias'), 'someaction action', 'dynamic action name in method call';
 is get('/param/somebase/SOMEPART'), 'upper as SOMEPART under somebase', 'value prepared at runtime in role body';
+is get('/param/somebase/short/foo'), 'short foo', 'dynamic base in shortcut declaration';
 
 done_testing;
index edce11a..c2c5431 100644 (file)
@@ -40,4 +40,8 @@ controller_role TestApp::ControllerRole::Parameterized (Str :$message, Str :$bas
     final action upper as $upper_part under $base {
         $ctx->response->body("upper as $upper_part under $base");
     }
+
+    final action short <- $base (Str $x) {
+        $ctx->response->body('short ' . $x);
+    }
 }