$_->($method)
for @populators;
- $attributes{PathPart} ||= "'$name'";
+ unless ($attributes{Private}) {
+ $attributes{PathPart} ||= "'$name'";
- delete $attributes{CaptureArgs}
- if exists $attributes{Args};
+ delete $attributes{CaptureArgs}
+ if exists $attributes{Args};
- $attributes{CaptureArgs} = 0
- unless exists $attributes{Args}
- or exists $attributes{CaptureArgs};
+ $attributes{CaptureArgs} = 0
+ unless exists $attributes{Args}
+ or exists $attributes{CaptureArgs};
+ }
+
+ if ($attributes{Private}) {
+# warn "PRIVATE $name";
+ delete $attributes{ $_ }
+ for qw( Args CaptureArgs Chained Signature Subname Action );
+ }
if ($ctx->peek_next_char eq '{') {
$ctx->inject_if_block($ctx->scope_injector_call . $method->injectable_code);
my @attributes = map {
join('',
$_,
- sprintf('(%s)',
- ref($attributes{ $_ }) eq 'ARRAY'
- ? join(' ', @{ $attributes{ $_ } })
- : $attributes{ $_ }
- ),
+ ref($attributes{ $_ }) eq 'ARRAY'
+ ? ( scalar(@{ $attributes{ $_ } })
+ ? sprintf('(%s)', join(' ', @{ $attributes{ $_ } }))
+ : '' )
+ : "($attributes{ $_ })"
);
} keys %attributes;
+# warn "ATTRS[ @attributes ]\n";
return $ctx->shadow(sub (&) {
my $class = caller;
$attrs->{Subname} = $name;
$attrs->{Signature} = $proto;
+ $attrs->{Action} = [];
if (defined $CatalystX::Declarative::SCOPE::UNDER) {
$attrs->{Chained} ||= $CatalystX::Declarative::SCOPE::UNDER;
$attrs->{Args} = defined($count) ? $count : '';
}
elsif ($what eq 'private') {
- $attrs->{Private} = 1;
+ $attrs->{Private} = [];
}
};
}
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 15;
+use Test::More tests => 16;
use Catalyst::Test 'TestApp';
# simple stuff
is get('/foo/finals/in_front'), 'foo/in_front', 'final syntax element as declarator';
is get('/foo/finals/final_middle'), 'foo/final_middle', 'final syntax element in the middle';
is get('/foo/finals/final_at_end'), 'foo/final_at_end', 'final syntax element at the end';
+
+# privates
+is get('/foo/expose_not_really_here'), 23, 'private action works';
under final_base, final action final_middle { $ctx->response->body($ctx->action->reverse) }
action final_at_end, final under final_base { $ctx->response->body($ctx->action->reverse) }
+
+
+ #
+ # privates
+ #
+
+ action not_really_here is private { $ctx->stash(foo => 23) }
+
+ action expose_not_really_here under base is final {
+ $ctx->forward('not_really_here');
+ $ctx->response->body($ctx->stash->{foo});
+ }
}