Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
開発中のアプリケーションフレームワーク(使用は非推奨)
Perl

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
benchmark
eg/hello-scripts
lib
script
t
xt
.gitignore
Changes
MANIFEST
MANIFEST.SKIP
Makefile.PL
README.pod

README.pod

NAME

Malts - web application framework

SYNOPSIS

    my $app = do {
        package MyApp::Dispatcher;
        use Malts::Web::Router::Simple;

        get '/' => sub {
            my ($c) = @_;
            my $name = $c->param('name');
            $c->render_string(200, sprintf 'Hello %s!', $name);
        };

        package MyApp;
        use parent 'Malts';

        __PACKAGE__->to_app;
    };

DESCRIPTION

TODO

METHODS

$class->new(%args | \%args) -> Object

Creates a new context object of whatever is based on Malts.

$class->context -> Object

Returns the context object.

$class->app -> Object

Returns the app object.

$class->boostrap(%args) -> Object

Create a new context object and set it to global context.

$class->to_app -> CodeRef

Create an instance of PSGI application.

$class->setup(%args) -> Object

Create a new context object.

    $class->setup(env => \%env); # Create request object from env.

$self->controller_base_name -> Str

Returns the controller name.

    my $c = MyApp->boostrap;
    print $c->controller_base_name; #=> print "MyApp::Controller"

$self->dispatcher_class -> Str

Returns the dispatcher class.

    my $c = MyApp->boostrap;
    print $c->dispatcher_class; #=> print "MyApp::Dispatcher"

$self->request_class -> Str

Returns the request class. defaults to a Malts::Web::Request.

$self->response_class -> Str

Returns the response class. defaults to a Malts::Web::Response.

$self->dispatch -> Object

$self->create_request(\%env) -> Object

Create a new request object.

$self->create_response($status, \@headers, $body) -> Object

Create a new response object.

$self->config

Exists but does nothing.

This is so you won't have to write a config if you don't want to.

$self->html_content_type -> Str

Returns the contet type. defaults to a "text/html; charset=UTF-8".

$self->encoding -> Object

Create/Get a encoding object using Encode::find_encoding('utf-8').

$self->create_headers -> ArrayRef

Create headers.

    Content-Type   : $self->html_content_type()
    Content-Length : Num
    X-Content-Type-Options : 'nosniff'
    X-Frame-Options        : 'DENY'

$self->render($status, $template_path) -> Object

Create a response object.

$self->render_string($status, $body) -> Object

Create a response object.

$class->load_plugins(@plugins)

Load plugins.

    $class->load_plugins(
        'Hoge',         # Malts::Plugin::Hoge->init($class);
        '+MyApp::Fuga', # MyApp::Fuga->init($class);
        'Piyo' => {},   # Malts::Plugin::Piyo->init($class, {});
    );

$class->load_plugin($plugin => $config)

Load a plugin.

$class->add_hooks($hook_name => \&hook_code)

Add hooks.

$class->add_hook($hook_name => \&hook_code)

Add a hook.

$class->run_hooks($hook_name)

Run hooks.

$class->get_hook_codes($hook_name) -> ArrayRef

Returns hook codes.

$class->add_methods($method_name => \&method_code)

Add methods.

$class->add_method($method_name => \&method_code)

Add a method.

$self->req -> Object

Returns a request object.

$self->request -> Object

Returns a request object.

$self->args -> HashRef

Shortcut to $self->req->args().

$self->param($param_name) -> Str

Shortcut to $self->req->param().

$self->session -> Str

Shortcut to $self->req->session().

$self->param_raw($param_name) -> Str

Shortcut to $self->req->param_raw().

$self->uri_for($path, \@params) -> Object

Create an URI object.

$self->uri_with(\@params) -> Object

Create an URI object.

$self->redirect($uri, $status) -> Object

Create a response object.

Something went wrong with that request. Please try again.