| Plack documentation | Contained in the Plack distribution. |
Plack::Middleware::XFramework - Sample middleware to add X-Framework
enable "Plack::Middleware::XFramework", framework => "Catalyst";
This middleware adds X-Framework header to the HTTP response.
Sets the string value of X-Framework header. If not set, the header is not set to the response.
| Plack documentation | Contained in the Plack distribution. |
package Plack::Middleware::XFramework; use strict; use warnings; use parent qw/Plack::Middleware/; use Plack::Util; use Plack::Util::Accessor qw( framework ); sub call { my $self = shift; my $res = $self->app->( @_ ); $self->response_cb($res, sub { my $res = shift; if ($self->framework) { Plack::Util::header_set $res->[1], 'X-Framework' => $self->framework; } }); } 1; __END__