NAME

Pickles::Context - Pickles context class.

SYNOPSIS

package MyApp::Context;

use strict;
use warnings;
use parent 'Pickles::Context';
__PACKAGE__->load_plugins(qw(Encode));
 
1;

__END__

METHODS

$c->appname

returns a application name.

$c->request, $c->req

returns a request object.

$c->response, $c->res

returns a response object.

$c->config

returns config object.

$c->render( [ $view_class ] );

render content with specified view class. if $view_class is omitted, $c->view_class is used as default.

$c->uri_for( @path, \%query );

construct absolute uri of the @path. \%query values are treat as QUERY_STRING.

$c->redirect( $url, [ $code ] );

redirect to the $url. default $code is 302. if $url is not absolute, the value is passed to $c->uri_for

$c->abort

abort next operation and goto finalize phase.

MyApp::Context->load_plugins(...);

load plugins. Omit the Pickles::Plugin:: prefix from the name.

$c->register( $name, $initializer );

Register a object. This method is delegated to Container. see Pickles::Container for details.

$c->get( $name );

get the registerred object referred by the given $name. This method is delegated to Container.

CLASS VARIABLES

The following class variables specify component classes. Omit the $c->appname prefix from the class name.

# MyApp::View
MyApp::Context->view_class('View');

# MyApp::View::TT
MyApp::Context->view_class('View::TT');

if you want to use fully qualified class name, use plus sign prefix.

# Foo::View
MyApp::Context->view_class('+Foo::View');

MyApp::Context->request_class

default value is +Pickles::Request

MyApp::Context->response_class

default value is +Pickles::Response

MyApp::Context->view_class

default value is View

AUTHOR

Tomohiro Ikebe <ikebe {at} livedoor.jp>

SEE ALSO

LICENSE

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