MVC::Neaf::View - Base [V]iew for Not Even A Framework.
Subclass this class to make your own content rendering engine under Neaf.
Neaf stands for Not Even A Framework. It works by (1) getting a hash from a sub which is pathetically called Controller, and (2) passing that hash over to an object called View.
A subset of hash keys is used to control the framework's own behaviour. Such -keys -are -prefixed -with -a -dash for greater visibility. These keys are NOT guaranteed to get to your engine, unless documentation explicitly states otherwise.
View in turn has a single method called render().
NOTE Please always use $self->dir($path) whenever dealing with templates or resources when subclassing this class.
As of current, the one and only method (except constructor) is needed, render.
Options may include:
on_render - a callback to be called in the render sub was not defined. Useful if you are too lazy to subclass.
neaf_base_path - a directory to calculate relative template paths from.
NOTE The constructor of this particular class happily encloses itself over any data one gives to it. No checks are performed. This may change in the future.
render MUST return a pair of values:
my ($content, $content_type) = $obj->render( \%hash );
render MAY die, resulting in a special view being processed, or a text error message as a last resort.
There are a lot of templating engines, serializers etc. in the world. The author of this tiny framework is not able to keep an eye on all of them. Thus making your custom views is encouraged.
Please send patches, improvements, suggestions and bug reports to
This module is part of MVC::Neaf suite.
Copyright 2016-2023 Konstantin S. Uvarin email@example.com.
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 MVC::Neaf, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.