X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FChained.pm;h=a29cb7419ae89f33f2c9d0804668d3696d955bca;hp=18e7c5928e81fc81f37d037fd4a1722eb1beaf2e;hb=dd97c1ac48f275a692de1d2ce980e9d3155d78b9;hpb=fd4d9ff7a23f97c2d96114ac777badcd1ff92459 diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index 18e7c59..a29cb74 100644 --- a/lib/Catalyst/DispatchType/Chained.pm +++ b/lib/Catalyst/DispatchType/Chained.pm @@ -7,6 +7,7 @@ use Text::SimpleTable; use Catalyst::ActionChain; use Catalyst::Utils; use URI; +use Scalar::Util (); has _endpoints => ( is => 'rw', @@ -307,6 +308,23 @@ sub register { $self->_actions->{'/'.$action->reverse} = $action; + if (exists $action->attributes->{Args}) { + my $args = $action->attributes->{Args}->[0]; + if (defined($args) and not ( + Scalar::Util::looks_like_number($args) and + int($args) == $args + )) { + require Data::Dumper; + local $Data::Dumper::Terse = 1; + local $Data::Dumper::Indent = 0; + $args = Data::Dumper::Dumper($args); + Catalyst::Exception->throw( + "Invalid Args($args) for action " . $action->reverse() . + " (use 'Args' or 'Args()'" + ); + } + } + unless ($action->attributes->{CaptureArgs}) { unshift(@{ $self->_endpoints }, $action); }