8 use File::Path qw(make_path);
9 use File::Basename qw (fileparse);
10 use File::Copy::Recursive qw(fcopy);
16 my @files = File::Find::Rule->file()
20 #initialize template toolkit
22 my $template = Template->new;
25 make_path($out_dir) or die "Could not create outdir $out_dir: $!";
28 foreach my $file (@files) {
29 next if $file =~ /^$out_dir/;
30 next if $file =~ /$0$/;
31 if ($file =~ /\.tt2$/) {
33 $template->process($file, undef, \$output)
34 || die "Could not process file \"$file\": $!";
36 my ($name,$path,$suffix) = fileparse($file,qw (.tt2));
37 open (my $fh, '>', "$out_dir/$path/$name")
38 or die "Could not write to $file: $!";
42 fcopy ($file, "$out_dir/$file") or die "Could not copy $file to $out_dir/$file: $!";