]> Sergey Matveev's repositories - zk.git/commitdiff
Proper "exists" usage instead of "defined"
authorSergey Matveev <stargrave@stargrave.org>
Thu, 8 May 2025 07:57:51 +0000 (10:57 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 8 May 2025 07:58:04 +0000 (10:58 +0300)
zk

diff --git a/zk b/zk
index d1bbdf1f4a55b38f171c6450d6a72af2922d31fc..2e8c33850001a5fa03d7729bd386b89dc9e8a8c4 100755 (executable)
--- a/zk
+++ b/zk
@@ -170,7 +170,7 @@ for my $pth (keys %mtimes) {
     next if $#ws == -1;
     $links{$pth} = \@ws;
     foreach (@ws) {
-        if (not defined $backs{$_}) {
+        if (not exists $backs{$_}) {
             my %h;
             $backs{$_} = \%h;
         }
@@ -202,7 +202,7 @@ use File::Basename;
 sub genHTML {
     my $out = shift;
     my $page = shift;
-    my @lnks = defined $links{$page} ? @{$links{$page}} : ();
+    my @lnks = exists $links{$page} ? @{$links{$page}} : ();
     my @rels;
     {
         my $rel;
@@ -258,7 +258,7 @@ sub genHTML {
         print $out "<a id=\"links\"></a><table border=1><caption>Links</caption>\n";
         my $mtime;
         while (my ($i, $l) = each @lnks) {
-            $mtime = (defined $mtimes{$l}) ? $mtimes{$l} : "";
+            $mtime = (exists $mtimes{$l}) ? $mtimes{$l} : "";
             print $out "<tr><td><a href=\"$rels[$i].html\">$l</a></td>
     <td><tt>$mtime</tt></td></tr>\n";
         }