root/lang/perl/HTTP-Engine-Middleware/trunk/t/lib/Foo/Middleware/Middle.pm @ 29321

Revision 29321, 426 bytes (checked in by yappo, 6 years ago)

svk sm branches/declare/ trunk/

Line 
1package Foo::Middleware::Middle;
2use HTTP::Engine::Middleware;
3
4outer_middleware 'Foo::Middleware::Outer';
5inner_middleware 'Foo::Middleware::Inner';
6
7before_handle {
8    my($c, $self, $req) = @_;
9    $req->header( 'X-Middle' => $c->method_class->before );
10    $req;
11};
12
13after_handle {
14    my($c, $self, $req, $res) = @_;
15    $res->body( 'from inner (' . $res->body . ')' ) if $res->body eq 'ok';
16    $res;
17};
18
19__MIDDLEWARE__
Note: See TracBrowser for help on using the browser.