Eidolon::Driver::Template - Eidolon generic template driver.
Example template driver:
package MyApp::Driver::Template; use base qw/Eidolon::Driver::Template/; sub parse { my ($self, $tpl) = @_; throw DriverError::Template::Open("This is just an example!"); } sub render { my $self = shift; throw DriverError::Template::Open("This is just an example!"); }
The Eidolon::Driver::Template is a generic template driver for Eidolon. It declares some functions that are common for all driver types and some abstract methods, that must be overloaded in ancestor classes. All template drivers should subclass this package.
Class constructor. Sets initial class data: $templates_dir - directory where template file will be placed, and checks if $template_dir directory exists, and if it doesn't - throws an exception.
$templates_dir
$template_dir
Sets template variables. %vars - hash of variables and corresponding values. For example:
%vars
( "title" => "Hello, world!", "content" => "Blabla" )
Parses a $tpl template. Abstract method, should be overloaded in ancestor class.
$tpl
Renders a previously parsed template. Abstract method, should be overloaded in ancestor class.
Eidolon, Eidolon::Driver::Template::Exceptions
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Anton Belousov, <abel@cpan.org>
Copyright (c) 2009, Atma 7, http://www.atma7.com
To install Eidolon, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Eidolon
CPAN shell
perl -MCPAN -e shell install Eidolon
For more information on module installation, please visit the detailed CPAN module installation guide.