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

NAME

MVC::Neaf::View - Base [V]iew for Not Even A Framework.

DESCRIPTION

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().

METHODS

As of current, the one and only method (except constructor) is needed, render.

new( %options )

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.

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( \%hash )

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.

CONCLUSION

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

https://github.com/dallaylaen/perl-mvc-neaf