Fix Perl deprecation warnings.
authorVictor van den Elzen <victor.vde@gmail.com>
Sun, 7 Nov 2010 16:20:23 +0000 (17:20 +0100)
committerVictor van den Elzen <victor.vde@gmail.com>
Sun, 7 Nov 2010 16:20:23 +0000 (17:20 +0100)
Use of defined on aggregates (hashes and arrays) is deprecated.
You should instead use a simple test for size.

directiv.pl
perllib/phash.ph
phash.pl
pptok.pl
tokhash.pl

index 684f542..0417f56 100755 (executable)
@@ -95,7 +95,7 @@ if ($output eq 'h') {
     }
 
     @hashinfo = gen_perfect_hash(\%directive);
-    if (!defined(@hashinfo)) {
+    if (!@hashinfo) {
        die "$0: no hash found\n";
     }
 
index 5bc2744..936978a 100644 (file)
@@ -161,7 +161,7 @@ sub gen_perfect_hash($) {
        for ($j = 0; $j < $maxj; $j++) {
            $sv = $random_sv_vectors[$j];
            @hashinfo = gen_hash_n($n, $sv, $href, $run++);
-           return @hashinfo if (defined(@hashinfo));
+           return @hashinfo if (@hashinfo);
        }
        $n <<= 1;
     }
index cc9ca74..3ef6e71 100755 (executable)
--- a/phash.pl
+++ b/phash.pl
@@ -75,7 +75,7 @@ sub main() {
     %data = read_input();
     @hashinfo = gen_perfect_hash(\%data);
 
-    if (!defined(@hashinfo)) {
+    if (!@hashinfo) {
        die "$0: no hash found\n";
     }
 
index c9738d3..be85b94 100755 (executable)
--- a/pptok.pl
+++ b/pptok.pl
@@ -164,7 +164,7 @@ if ($what eq 'c') {
     }
 
     my @hashinfo = gen_perfect_hash(\%tokens);
-    if (!defined(@hashinfo)) {
+    if (!@hashinfo) {
        die "$0: no hash found\n";
     }
 
index 0c69c03..6c05802 100755 (executable)
@@ -183,7 +183,7 @@ if ($output eq 'h') {
     #
 
     @hashinfo = gen_perfect_hash(\%tokens);
-    if (!defined(@hashinfo)) {
+    if (!@hashinfo) {
        die "$0: no hash found\n";
     }