#!/usr/bin/perl
BEGIN {
$| = 1;
$^W = 1;
}
my
$INCLUDE_PATH
= catdir(
't'
,
'template'
);
my
$COMPILE_DIR
= File::Temp::tempdir(
CLEANUP
=> 1 );
ok( -d
$INCLUDE_PATH
,
'Found template directory'
);
ok( -d
$COMPILE_DIR
,
'Found compile directory'
);
my
$provider
= Template::Provider::Preload->new(
DEBUG
=> 1,
STAT_TTL
=> 1,
INCLUDE_PATH
=>
$INCLUDE_PATH
,
);
isa_ok(
$provider
,
'Template::Provider'
);
is_deeply(
$provider
->paths, [
$INCLUDE_PATH
],
'->paths ok'
);
$provider
->prefetch;
my
$template
= Template->new(
DEBUG
=> 1,
LOAD_TEMPLATES
=> [
$provider
],
);
isa_ok(
$template
,
'Template'
);
my
$output
=
''
;
$template
->process(
'a/b/c/hello.tt'
, {
name
=>
'Ingy'
}, \
$output
)
or
do
{
die
$template
->error;
};
is(
$output
,
"Hello, Ingy.\n"
,
"output is correct"
);
1;