Kolon based Amon2::Lite
Perl
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/Amon2
t
xt
.gitignore
Build.PL
Changes
LICENSE
MANIFEST
MANIFEST.SKIP
README.pod

README.pod

NAME

Amon2::Aero - Variation of Amon2::Lite for Xslate/Kolon syntax

SYNOPSIS

    use Amon2::Aero;

    get '/' => sub {
        my ($c) = @_;
        return $c->render('index.tt');
    };

    __PACKAGE__->to_app();

    __DATA__

    @@ index.tt
    <!doctype html>
    <html>
        <body>Hello</body>
    </html>

DESCRIPTION

This is a Sinatra-ish wrapper for Amon2.

THIS MODULE IS BETA STATE. API MAY CHANGE WITHOUT NOTICE.

FUNCTIONS

any(\@methods, $path, \&code)
any($path, \&code)

Register new route for router.

get($path, $code->($c))

Register new route for router.

post($path, $code->($c))

Register new route for router.

__PACKAGE__->load_plugin($name, \%opts)

Load a plugin to the context object.

__PACKAGE__->to_app()

Create new PSGI application instance.

FAQ

How can I configure the options for Xslate?

You can provide a constructor arguments by configuration. Write following lines on your app.psgi.

    __PACKAGE__->template_options(
        syntax => 'Kolon',
    );
How can I use other template engines instead of Text::Xslate?

You can use any template engine with Amon2::Aero. You can overwrite create_view method same as normal Amon2.

This is a example to use Text::MicroTemplate::File.

    use Tiffany::Text::MicroTemplate::File;

    sub create_view {
        Tiffany::Text::MicroTemplate::File->new(+{
            include_path => ['./tmpl/']
        })
    }
How can I handle static files?

If you pass the 'handle_static' option to 'to_app' method, Amon2::Aero handles /static/ path to ./static/ directory.

    use Amon2::Aero;
    __PACKAGE__->to_app(handle_static => 1);

AUTHOR

Fuji Goro (gfx) <gfuji at cpan.org>

THANKS TO

This is a fork from Amon2::Lite, written by Tokuhiro Matsuno (tokuhirom).

SEE ALSO

Amon2

Amon2::Lite

LICENSE

Copyright (C) Fuji Goro (gfx)

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