From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

use strict;
BEGIN { $^W = 1; $| = 1; print "1..1\n"; }
use constant TEMPLATE => 't/2_ifn.tmpl';
use constant COMPARE => 't/2_ifn.comp';
my($compare, $output);
my $context = Text::Tmpl::init();
if (! defined $context) {
print "not ok 1\n";
exit(0);
}
my $comp_fh = new IO::File COMPARE, "r";
if (! defined $comp_fh) {
print "not ok 1\n";
exit(0);
}
{
local $/ = undef;
$compare = <$comp_fh>;
}
$comp_fh->close;
$context->set_strip(0);
$context->set_value('true', Text::Tmpl::TEMPLATE_TRUE);
$context->set_value('false', Text::Tmpl::TEMPLATE_FALSE);
$output = $context->parse_file(TEMPLATE);
if ($output ne $compare) {
print "not ok 1\n";
} else {
print "ok 1\n";
}
Text::Tmpl::destroy($context);