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;
};
}
Currently, when the arguments do not fit the signature because of a L<Moose>
validation error, the response body will be set to C<Bad Request> and the
-status to C<400>.
+status to C<400>. This only applies when debug mode is off. If it is turned on,
+the error message will be prefixed with C<BAD REQUEST: >.
=head2 Actions and Method Modifiers
use CatalystX::Declare;
- controller_role MyApp::Web::ControllerRole::RichBase {
+ component_role MyApp::Web::ControllerRole::RichBase {
before base (Object $ctx) {
$ctx->stash(something => $ctx->model('Item'));