Convert script to strict mode
authorJoey Schulze <joey@infodrom.org>
Sun, 29 Apr 2018 17:00:45 +0000 (19:00 +0200)
committerJoey Schulze <joey@infodrom.org>
Sun, 29 Apr 2018 17:00:45 +0000 (19:00 +0200)
bin/wmldepend.pl

index 3c7dc5a..4b6926a 100755 (executable)
@@ -1,7 +1,10 @@
 #! /usr/bin/perl
 
 #! /usr/bin/perl
 
-$INCPATH = "";
-$FILES = "";
+use strict;
+use warnings;
+
+my @INCPATH;
+my @FILES;
 
 # expandfile() {
 #        for i in $INCPATH
 
 # expandfile() {
 #        for i in $INCPATH
@@ -23,6 +26,7 @@ sub expandfile
     my $f = shift;
     my %var = @_;
     my $p;
     my $f = shift;
     my %var = @_;
     my $p;
+    my $pivot;
 
     if ($f =~ m,\$\((.*)\),) {
        $pivot = $1;
 
     if ($f =~ m,\$\((.*)\),) {
        $pivot = $1;
@@ -75,7 +79,7 @@ sub findincludes
 
 # Argument parsing
 #
 
 # Argument parsing
 #
-while ($foo = shift (@ARGV)) {
+while (my $foo = shift (@ARGV)) {
     if ($foo =~ m,-I(.*),) {
        push (@INCPATH, $1);
     } else {
     if ($foo =~ m,-I(.*),) {
        push (@INCPATH, $1);
     } else {
@@ -83,9 +87,9 @@ while ($foo = shift (@ARGV)) {
     }
 }
 
     }
 }
 
-%var=();
-for $f (@FILES) {
-    $foo = $f;
+my %var;
+foreach my $f (@FILES) {
+    my $foo = $f;
     $foo =~ s/\.wml$/\.php/;
     printf "%s: %s", $foo, $f;
     findincludes ($f, %var);
     $foo =~ s/\.wml$/\.php/;
     printf "%s: %s", $foo, $f;
     findincludes ($f, %var);