|my $tiffany = Tiffany->load($klass, $args)||Load Tiffany::* class if necessary, and create new instance of using the given arguments.|
The Tiffany protocol is based on duck typing. A template adaptor does not need to inherit from a particular class, but its API needs to adhere to the spec provided here.
In the documentation that follows, Tiffany::Thing represents an adaptor class.
my $tiffanny = Tiffany::Thing->new([$args:HashRef|ArrayRef]); The module SHOULD have a <B>newB> method.
This method creates a new instance of Tiffany module.
$args should be passed to the constructor of the template engine.
my $result = $tmpl->render($stuff:Scalar|ScalarRef [, @args]); The module SHOULD have a <B>renderB> method.
This method should invoke the appropriate rendering method for the underlying template engine, using @args.
If the template engine found any errors, this method MUST throw an exception.
If the template engine throws any exceptions, Tiffany module SHOULD pass through the exception unaltered.
This method MUST return plain string. Do not return a blessed reference.
Example code is here: eg/sinatraish/ in distribution tar ball or <http://github.com/tokuhirom/p5-tiffany/tree/master/eg/sinatraish/>.
Is Tiffany supports JSON? Tiffany should not support JSON. Tiffany protocol can support JSON serialize. But real web application needs more things like Content-Type. It is not supported area for Tiffany.
Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>
Copyright (C) Tokuhiro Matsuno
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|perl v5.20.3||TIFFANY (3)||2016-03-18|