NAME Plack::Middleware::FileWrap - Wrap file with headers/footers in Plack VERSION version 0.01 SYNOPSIS use Plack::Builder; # with text mount '/static/docs/' => builder { enable 'FileWrap', headers => [\'TEST HEAD'], footers => [\'TEST FOOT']; Plack::App::File->new( root => "/path/to/static/docs" )->to_app; }, # with file builder { enable 'FileWrap', headers => ['/path/to/headerA.html', '/path/to/headerB.html'], footers => ['/path/to/footer.html']; $app; }, DESCRIPTION Enable this middleware to allow your Plack-based application to have common header/footer. CONFIGURATIONS headers, footers Arrayref. Text ref or file paths. can be mixed like headers => [ \'', '/path/to/file/header.html' ] EXAMPLES with enable_if If you have images or other files under the same directory and you don't want to apply the changes, please use enable_if: mount '/static/docs/' => builder { enable_if { $_[0]->{PATH_INFO} =~ /\.html/ } 'FileWrap', headers => ["$root/static/docs/header.html"], footers => ["$root/static/docs/footer.html"]; Plack::App::File->new( root => "$root/static/docs" )->to_app; }, AUTHOR Fayland Lam COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Fayland Lam. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.