}
if ($attributes{Private}) {
-# warn "PRIVATE $name";
delete $attributes{ $_ }
for qw( Args CaptureArgs Chained Signature Subname Action );
}
: "($attributes{ $_ })"
);
} keys %attributes;
-# warn "ATTRS[ @attributes ]\n";
return $ctx->shadow(sub (&) {
my $class = caller;
my $name = $ctx->strip_name
or croak "Anonymous actions not yet supported";
+ $ctx->skipspace;
+ my $populator;
+
+ if (substr($ctx->get_linestr, $ctx->offset, 2) eq '<-') {
+ my $linestr = $ctx->get_linestr;
+ substr($linestr, $ctx->offset, 2) = '';
+ $ctx->set_linestr($linestr);
+ $populator = $self->_handle_under_option($ctx, $attrs);
+ }
+
# signature
my $proto = $ctx->strip_proto || '';
$proto = join(', ', 'Object $self: Object $ctx', $proto || ());
$attrs->{Chained} ||= $CatalystX::Declarative::SCOPE::UNDER;
}
- return;
+ return unless $populator;
+ return $populator;
}
method _handle_final_option (Object $ctx, HashRef $attrs) {
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 16;
+use Test::More tests => 17;
use Catalyst::Test 'TestApp';
# simple stuff
# privates
is get('/foo/expose_not_really_here'), 23, 'private action works';
+
+# specify chain target directly via action
+is get('/foo/pointed/beaver'), 'Your beaver is pointed!', 'chain target specified via action';
$ctx->forward('not_really_here');
$ctx->response->body($ctx->stash->{foo});
}
+
+
+ #
+ # chain target specified via action
+ #
+
+ action pointed <- base ($what) is final { $ctx->response->body("Your $what is pointed!") }
}