Skip to content

Commit

Permalink
Enable STRICT in the Template-Toolkit code
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomif committed Dec 2, 2024
1 parent 3545394 commit 840c5e8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
7 changes: 6 additions & 1 deletion cpan/Games-Solitaire-Verify/benchmark/gen-par-mak.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use strict;
use warnings;
use autodie;

use Template ();

Expand All @@ -19,7 +20,11 @@
step => $STEP,
};

my $template = Template->new( {} );
my $template = Template->new(
{
STRICT => 1,
}
);

my $TEXT = <<'EOF';
all:[% FOREACH i = [min .. max] %] [% res(i) %][% END %]
Expand Down
16 changes: 5 additions & 11 deletions fc-solve/site/wml/lib/FreecellSolver/Site/TTRender.pm
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,13 @@ EOF
};
$vars->{enable_jquery_ui} =
( $input_tt2_page_path ne 'js-fc-solve/text/gui-tests.xhtml' );

my $src_path = "src/$input_tt2_page_path.tt2";
if ( $self->stdout )
{
binmode STDOUT, ':encoding(utf-8)';
my $html = '';
$template->process( "src/$input_tt2_page_path.tt2",
$vars, \$html, binmode => ':utf8', )
or die "[["
. $template->error()
. " ; src/$input_tt2_page_path.tt2 ]]";
$template->process( $src_path, $vars, \$html, binmode => ':utf8', )
or die "[[" . $template->error() . " ; $src_path ]]";

$toc->add_toc( \$html );
print $html;
Expand All @@ -395,11 +392,8 @@ EOF
my $d = $rec->{path};
$vars->{production} = $rec->{production};
my $html = '';
$template->process( "src/$input_tt2_page_path.tt2",
$vars, \$html, binmode => ':utf8', )
or die "[["
. $template->error()
. " ; src/$input_tt2_page_path.tt2 ]]";
$template->process( $src_path, $vars, \$html, binmode => ':utf8', )
or die "[[" . $template->error() . " ; $src_path ]]";

$toc->add_toc( \$html );
path( @$d, @fn, )->touchpath()->spew_utf8($html);
Expand Down
6 changes: 5 additions & 1 deletion fc-solve/source/scripts/gen-presets.pl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ sub compile_preset
return;
}

my $c_template = Template->new();
my $c_template = Template->new(
{
STRICT => 1,
},
);

my $C_TEMPLATE_INPUT = <<"EOF";
{
Expand Down
2 changes: 1 addition & 1 deletion fc-solve/source/t/generate-card-tests.pl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sub rank_normalize
( path("../include/freecell-solver/fcs_back_compat.h")->slurp_utf8 =~
/^#define FCS_BREAK_BACKWARD_COMPAT_1\r?$/ms ? 1 : 0 );

my $template = Template->new( { ABSOLUTE => 1, }, );
my $template = Template->new( { ABSOLUTE => 1, STRICT => 1, }, );

sub indexify
{
Expand Down

0 comments on commit 840c5e8

Please sign in to comment.