Plack::Middleware::ETag - Adds automatically an ETag header.
use Plack::Builder; my $app = builder { enable "Plack::Middleware::ETag", file_etag => [qw/inode mtime size/]; sub {['200', ['Content-Type' => 'text/html'}, ['hello world']]}; };
Plack::Middleware::ETag adds automatically an ETag header. You may want to use it with Plack::Middleware::ConditionalGET.
Plack::Middleware::ConditionalGET
my $app = builder { enable "Plack::Middleware::ConditionalGET"; enable "Plack::Middleware::ETag", file_etag => "inode"; sub {['200', ['Content-Type' => 'text/html'}, ['hello world']]}; };
If the content is a file handle, the ETag will be set using the inode, modified time and the file size. You can select which attributes of the file will be used to set the ETag:
enable "Plack::Middleware::ETag", file_etag => [qw/size/];
franck cuny <franck@lumberjaph.net>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Plack::Middleware::ETag, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Middleware::ETag
CPAN shell
perl -MCPAN -e shell install Plack::Middleware::ETag
For more information on module installation, please visit the detailed CPAN module installation guide.