Dai Okabayashi > Plack-App-DummyBox-0.041 > Plack::App::DummyBox

Download:
Plack-App-DummyBox-0.041.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.041   Source  

NAME ^

Plack::App::DummyBox - generate dummy box image for web development

SYNOPSIS ^

    # app.psgi
    use Plack::App::DummyBox;
    my $dummy_box_app = Plack::App::DummyBox->new->to_app;

    # then map it
    use Plack::Builder;
    builder {
        mount "/dummy_box" => $dummy_box_app;
    };

DESCRIPTION ^

Plack::App::DummyBox generates dummy box images. You can easily get dot images(1x1 git/png) or free size box images. This module may help your designers to make mock of service.

PARAMETERS ^

You can set query parameters every request.

width

box width size(pixel). w is alias as width: default 1

height

box height size(pixel). h is alias as height: default 1

ext

extension of image: gif or png, default gif

fill

color of box: default white

border

border color of box: default gray

line

size of border line(pixel): default 1

CONSTRACTOR OPTIONS ^

    my $dummy_box_app = Plack::App::DummyBox->new(
        max_width  => 640,
        max_height => 480,
        font => +{
            file  => "/path/to/font_file.ttf",
            type  => "ft2",
            size  => 15,    # option
            color => 'red', # option
        },
        text   => "foo",
        filter => sub {
            my ($self, $img) = @_;
            # .. do something ..
        },
        cache => Cache::File->new(cache_root => '/tmp/cache'),
        stderr => 1,
    )->to_app;
max_width, max_height

if the size was over, response HTTP STATUS: 400.

font

If you want to see image size as text on the image, you should set font option. see Imager::Font

text

add a text in the image. text option also requires font option. Note that text string should be decoded utf8 text when it included not ascii strings.

filter

filter should code reference. This method receives the $self and Imager object.

cache

If you want to cache responses between requests, provide the cache parameter with an object supporting the Cache API(e.g. Cache::File). Specifically, an object that supports $cache->get($key) and $cache->set($key, $value, $expires).

stderr

print error message to STDERR when some error was happen.

METHODS ^

prepare_app
call
return_status($status_code)

return HTTP status and message.

REPOSITORY ^

Plack::App::DummyBox is hosted on github <http://github.com/bayashi/Plack-App-DummyBox>

AUTHOR ^

Dai Okabayashi <bayashi@cpan.org>

SEE ALSO ^

Plack::Component, Image::Empty, Imager

LICENSE ^

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

syntax highlighting: