The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

use Moose;
BEGIN {
}
sub normal_closure : Local {
my ($self, $ctx) = @_;
$ctx->stash(closure => sub {
$ctx->response->body('from normal closure');
});
$ctx->response->body('stashed normal closure');
}
sub context_closure : Local {
my ($self, $ctx) = @_;
$ctx->stash(closure => $self->make_context_closure(sub {
my ($ctx) = @_;
$ctx->response->body('from context closure');
}, $ctx));
$ctx->response->body('stashed context closure');
}
sub non_closure : Local {
my ($self, $ctx) = @_;
$ctx->stash(no_closure => "not a closure");
}
__PACKAGE__->meta->make_immutable;
1;