NAME

Text::MicroTemplate::DataSection - Render Text::MicroTemplate from __DATA__.

SYNOPSIS

use Text::MicroTemplate::DataSection 'render_mt';

# Functional interface -- reads template from caller package __DATA__
$html = render_mt('index');  # render index.mt

# OO - allows reading from other packages
my $mt = Text::MicroTemplate::DataSection->new( package => $package );
$html = $mt->render('index');

# support Text::MicroTemplate::Extended with 'Ex' postfix.
use Text::MicroTemplate::DataSectionEx 'render_mt';

$html = render_mt('child');  # template inheritance also supported

__DATA__

@@ index.mt
<html>
 <body>Hello</body>
</html>

@@ base.mt
<html>
 <body><? block body => sub { ?>default body<? } ?></body>
</html>

@@ child.mt
? extends 'base';

? block body => sub {
child body
? } # endblock body

DESCRIPTION

Text::MicroTemplate::DataSection is simple wrapper module allows you to render MicroTemplate template from __DATA__ section.

This module based Text::MicroTemplate::File, if you want to use extended feature such as template inheritance, macro or etc by Text::MicroTemplate::Extended, use "Text::MicroTemplate::DataSectionEx" instead of "Text::MicroTemplate::DataSection".

SEE ALSO

Text::MicroTemplate, Text::MicroTemplate::Extended, Data::Section::Simple.

AUTHOR

Daisuke Murase <typester@cpan.org>

COPYRIGHT AND LICENSE

Copyright (c) 2010 by KAYAC Inc.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.