root/lang/perl/HTTP-Engine/trunk/examples/MiddleWare.pm @ 11522

Revision 11522, 346 bytes (checked in by tokuhirom, 7 years ago)

change middleware spec.

Line 
1package examples::MiddleWare;
2use Moose;
3# with 'HTTP::Engine::Role::Middleware';
4
5sub setup {
6    warn 'middleware setup';
7}
8
9sub wrap {
10    my($next, $rp, $c) = @_;
11    warn 'middleware before';
12    $next->($rp, $c);
13    warn 'middleware after';
14    my $body = $c->res->body;
15    $body =~ s/REGEXP/MIDDLEWARE/g;
16    $c->res->body($body);
17}
18
191;
Note: See TracBrowser for help on using the browser.