[Templates] ttree 2.75 - patch against uninitialized value warnings

Harald Joerg haj@oook.m.uunet.de
Thu, 11 Mar 2004 00:46:20 +0100


The most recent version of ttree introduces a bunch of warnings for
every copied file because the $check variable isn't available when it
is be printed (BTW: I wonder whether implicit localisation of loop
variables did exist in Perl 5.6...).

Against the advice of Dylan William Hardison I dare to submit
a patch after midnight....

--- /usr/bin/ttree    2004-03-08 22:19:44.000000000 +0100
+++ /home/haj/bin/ttree    2004-03-11 00:34:56.309507200 +0100
@@ -323,7 +323,9 @@
   
     # check against copy list
-    foreach $check (@$copy) {
-        if ($filename =~ /$check/) {
+    foreach my $copy_pattern (@$copy) {
+        if ($filename =~ /$copy_pattern/) {
             $copy_file = 1;
+        $check = $copy_pattern;
+        last;
         }
     }