1use strict; 2use warnings; 3use Test::More (tests => 3); 4use Data::Dumper; 5use File::Temp; 6 7use_ok('HTML::Template'); 8 9my $tmp_dir = File::Temp->newdir(); 10 11my ($template, $output); 12 13# test file cache - non automated, requires turning on debug watching STDERR! 14$template = HTML::Template->new( 15 path => ['templates/'], 16 filename => 'simple.tmpl', 17 double_file_cache => 1, 18 file_cache_dir => $tmp_dir, 19); 20$template->param(ADJECTIVE => sub { "3y"; }); 21$output = $template->output; 22 23$template = HTML::Template->new( 24 path => ['templates/'], 25 filename => 'simple.tmpl', 26 double_file_cache => 1, 27 file_cache_dir => $tmp_dir, 28); 29 30ok($output =~ /3y/, "double_file_cache option provides expected output"); 31 32$template = HTML::Template->new( 33 path => ['templates/'], 34 filename => 'simple.tmpl', 35 cache => 1, 36); 37$template->param(ADJECTIVE => sub { return 't' . 'i' . '1m' . '2e' . '3l' . '4y'; }); 38$output = $template->output; 39 40$template = HTML::Template->new( 41 path => ['templates/'], 42 filename => 'simple.tmpl', 43 double_file_cache => 1, 44 file_cache_dir => $tmp_dir, 45); 46ok($output =~ /ti1m2e3l4y/, "double_file_cache option provides expected output"); 47 48=head1 NAME 49 50t/07-double-file-cache.t 51 52=head1 OBJECTIVE 53 54Test the previous untested C<double_file_cache> option to 55C<HTML::Template::new()>. 56 57 $template = HTML::Template->new( 58 path => ['templates/'], 59 filename => 'simple.tmpl', 60 double_file_cache => 1, 61 file_cache_dir => './blib/temp_cache_dir', 62 ); 63 64=cut 65