#!/usr/bin/perl use strict; use warnings; use Template; use IO::All; use YAML; my ($template_path, $output_path) = @ARGV; my $test_file_name = $output_path; $test_file_name =~ s/^/..\// or die; $test_file_name =~ s/\.html$/.js/ or die; my $t = Template->new( { INCLUDE_PATH => ['.', 'template/'], } ); my $config = YAML::LoadFile('../config.yaml'); my $data = { %$config, test_file => $test_file_name, all_test_files => [ glob('*.t.html') ], }; my $result; $t->process($template_path, $data, \$result) or die $t->error; io($output_path)->print($result);