NAME

Plack::Middleware::Favicon - deliver common favicon images

SYNOPSIS

use Plack::Builder;

builder {
    enable 'Favicon',
        src_image_file => 'src_favicon.png';
};

DESCRIPTION

You don't need to prepare favicon images any more if you use this module.

METHODS

prepare_app
call

MIDDLEWARE OPTIONS

cache

If you'd like this module to cache images for response, provide the cache option with an object supporting the Cache API (e.g. Cache::FileCache, Cache::Memory::Simple). Specifically, an object that supports get($key) and set($key, $value, $expires) methods.

use Cache::Memory::Simple;

builder {
    enable 'Favicon',
        src_image_file  => 'src_favicon.png',
        cache => Cache::Memory::Simple->new;
};

custom_favicons

If you'd provide custom favicon images, set the custom_favicons option.

builder {
    enable 'Favicon',
        src_image_file  => 'src_favicon.png',
        custom_favicons => [
            { path => qr!^/foo\.png!, size => [32, 32],
              type => 'png', mime_type => 'image/png' },
        ];
};

callback

If you'd want to filter image, set the callback option as code ref.

builder {
    enable 'Favicon',
        src_image_file  => 'src_favicon.png',
        callback => sub {
            my ($self, $f, $img) = @_;
            $img->filter(type => "unsharpmask", stddev => 1, scale => 0.5);
        };
};

REPOSITORY

Plack::Middleware::Favicon is hosted on github: http://github.com/bayashi/Plack-Middleware-Favicon

I appreciate any feedback :D

AUTHOR

Dai Okabayashi <bayashi@cpan.org>

SEE ALSO

http://itexp.hateblo.jp/entry/website-needs-21-favicons

http://ja.wikipedia.org/wiki/Favicon

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.