[Templates] another ttree patch

Mark Anderson mda@discerning.com
Tue, 07 Oct 2003 14:29:15 -0700


Currently, if there are any explicit files on @ARGV (versus just relying
on srcdir), ttree will internally call $template->process directly
bypassing all the processing that happens in the no-@ARGV case
via the function process_file():
   - suffix mapping (my previous patch)
   - mtime and accept checking
   - permission preserving
   - copy processing

(I discovered when I noticed that my patched ttree didn't do the
suffix processing when I had an explicit file on the command line.)

Here is how I've patched my local copy:

if (@ARGV) {
     # explicitly process files specified on command lines
     foreach my $file (@ARGV) {
         process_file($file, $srcdir ? "$srcdir/$file" : $file);
#	print "  + $file\n" if $verbose;
#	$template->process($file, $replace, $file)
#	    || print "  ! ", $template->error(), "\n";
     }
}

Note that this does change behavior; there may be people reliant on the
old behavior of not doing all of process_file's functionality.

-mda