Eve::HttpResource::Template - a simple HTTP resource with a template.
use Eve::HttpResource::Template; # Bind it to an URL using the HTTP resource dispatcher. See # B<Eve::HttpDispatcher> class. my $resource = Eve::HttpResource::Template->new( response => $response, session_constructor => $session_constructor, dispatcher => $dispatcher, template => $template, template_file => 'template.html', template_var_hash => {'some_var' => 1, 'other_var' => 2}, require_auth => 1, content_type => 'text/plain', charset => 'CP1251', text_var_hash => $text_var_hash); $dispatcher->bind( name => 'some_unique_name', pattern => '/some_uri', base_uri => $some_base_uri, resource_constructor => sub { return $resource; });
Eve::HttpResource::Template is a simple HTTP resource that only displays a parsed template. All the templates have the following objects available in their scope:
session
an instance of the Eve::Session object for the current user,
response
an HTTP response object,
session_constructor
a reference to a subroutine that returns a session object,
dispatcher
an HTTP dispatcher object,
template
a template object,
template_file
a template file name,
template_var_hash
(optional) a hash of variables to be passed to the processed template, defaults to an empty hash,
require_auth
(optional) if a user is not authenticated, throw a Eve::Exception::Http::401Unauthorized,
Eve::Exception::Http::401Unauthorized
content_type
(optional) response content-type, defaults to text/html,
text/html
charset
(optional) response character set, defaults to UTF-8.
UTF-8
Eve::HttpDispatcher
Eve::HttpResource
Eve::Template
Copyright 2012 Igor Zinovyev.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Eve, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Eve
CPAN shell
perl -MCPAN -e shell install Eve
For more information on module installation, please visit the detailed CPAN module installation guide.