Merge branch 'stricter-chained-arg-attrs' into SicilianButtercup
Dagfinn Ilmari Mannsåker [Fri, 24 May 2013 20:16:03 +0000 (21:16 +0100)]
Changes
lib/Catalyst/DispatchType/Chained.pm
t/dead_load_bad_args.t

diff --git a/Changes b/Changes
index e02ae76..ac27f9c 100644 (file)
--- a/Changes
+++ b/Changes
@@ -4,6 +4,7 @@ TBA
   ! Stricter checking of attributes in Catalyst::DispatchType::Chained:
     1) Only allow one of either :CaptureArgs or :Args
     2) :CaptureArgs() argument must be numeric
+    3) :CaptureArgs() and :Args() arguments cannot be negative
   - Add Devel::InnerPackage to dependencies, fixing tests on perl 5.17.11
     as it's been removed from core. RT#84787
   - New support for closing over the PSGI $writer object, useful for working
index 615f5aa..33e23d2 100644 (file)
@@ -298,7 +298,7 @@ sub _check_args_attr {
     my $args = $action->attributes->{$name}->[0];
     if (defined($args) and not (
         Scalar::Util::looks_like_number($args) and
-        int($args) == $args
+        int($args) == $args and $args >= 0
     )) {
         require Data::Dumper;
         local $Data::Dumper::Terse = 1;
index 8542a13..d80195f 100644 (file)
@@ -12,6 +12,7 @@ for my $fail (
     "(' ')",
     "('')",
     "('1.23')",
+    "(-1)",
 ) {
     for my $type (qw(Args CaptureArgs)) {
         eval <<"END";