root/lang/perl/HTTP-Engine/trunk/examples/MiddleWare.pm
@
11522
| Revision 11522, 346 bytes (checked in by tokuhirom, 5 years ago) |
|---|
| Line | |
|---|---|
| 1 | package examples::MiddleWare; |
| 2 | use Moose; |
| 3 | # with 'HTTP::Engine::Role::Middleware'; |
| 4 | |
| 5 | sub setup { |
| 6 | warn 'middleware setup'; |
| 7 | } |
| 8 | |
| 9 | sub 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 | |
| 19 | 1; |
Note: See TracBrowser
for help on using the browser.
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)