The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebNano::Controller - WebNano Controller

VERSION

version 0.004

DESCRIPTION

This is the WebNano base controller. It's handle method dispatches the request to appropriate action method or to a next controller.

The action method should return a string containing the HTML page, a Plack::Response object or a code ref.

SYNOPSIS With Moose:

    package MyApp::Controller;
    
    use Moose;
    use MooseX::NonMoose;

    extends 'WebNano::Controller';
    
    has '+url_map' => ( default => sub { { 'Mapped Url' => 'mapped_url' } } );
    
    sub index_action {
        my $self = shift;
        return $self->render( 'index.tt' );
    }
    
    sub mapped_url { 'This is the mapped url page' }
    
    1;

METHODS

handle

This is a class method - it receives the arguments, creates the controller object and then uses it's local_dispatch method.

Should return a Plack::Response object, a string containing the HTML page, a code ref or undef (which is later interpreted as 404).

render

Renders a template.

local_dispatch

Finds the method to be called for a given path and dispatches to it.

req

Plack::Reqest made from env

template_search_path

DEBUG

By default returns the DEBUG flag from the application. When this returns true then some additional logging is directed to STDOUT.

ATTRIBUTES

url_map

A hash that is used as path part to method map.

app

Links back to the application object.

env

PSGI environment

self_url

AUTHOR

Zbigniew Lukasiak <zby@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2010 by Zbigniew Lukasiak <zby@cpan.org>.

This is free software, licensed under:

  The Artistic License 2.0