AttributeRole->meta->apply($method);
+ my $count = $self->_count_positional_arguments($method);
+ $attributes{CaptureArgs} = $count
+ if defined $count;
+
$_->($method)
for @populators;
my @attributes;
for my $attr (keys %attributes) {
push @attributes,
- map { sprintf '%s(%s)', $attr, $_ }
+ map { sprintf '%s%s', $attr, defined($_) ? sprintf('(%s)', $_) : '' }
(ref($attributes{ $attr }) eq 'ARRAY')
? @{ $attributes{ $attr } }
: $attributes{ $attr };
my $method = shift;
if ($what eq any qw( end endpoint final )) {
- my $count = $self->_count_positional_arguments($method);
- $attrs->{Args} = defined($count) ? $count : '';
+ $attrs->{Args} = delete $attrs->{CaptureArgs};
}
elsif ($what eq 'private') {
$attrs->{Private} = [];
return sub {
my $method = shift;
-
- my $count = $self->_count_positional_arguments($method);
- $attrs->{CaptureArgs} = $count
- if defined $count;
};
}
# error handling
is get('/foo/wants_integer/butdoesntgetone'), 'Bad Request', 'validation error causes bad request error';
+# fix bug with capture args below under { }
+is get('/foo/lower/down/the/param/3/road/5'), 8, 'capture args and block under work together';
done_testing;
action stream is final {
$ctx->response->body($ctx->action->reverse);
}
+
+ action param (Int $x) {
+ $ctx->stash(param_x => $x);
+ }
+
+ under param {
+
+ final action road (Int $y) {
+ $ctx->response->body($ctx->stash->{param_x} + $y);
+ }
+ }
}
}
}