Преглед изворни кода

Better testing on whether the logfile has data, and tell the user if the
logfile didn't have any lines, so he knows.

Morten Brix Pedersen пре 25 година
родитељ
комит
64ad314e65
1 измењених фајлова са 7 додато и 5 уклоњено
  1. 7 5
      pisg.pl

+ 7 - 5
pisg.pl

@@ -167,11 +167,13 @@ _END
         return undef;
         return undef;
     }
     }
 
 
-    $generator->create_html()
-        if (defined $stats and $stats->{lines} > 0);# Create the HTML
-                                 # (look here if you want to remove some of the
-                                 # stats which you don't care about)
-
+    # Create our HTML page if the logfile has any data.
+    if (defined $stats and $stats->{totallines} > 0) {
+        $generator->create_html();
+    } elsif ($stats->{totallines} == 0) {
+        print STDERR "No lines found in logfile.. skipping.\n";
+    }
+    
     $conf->{chan_done}{$conf->{channel}} = 1;
     $conf->{chan_done}{$conf->{channel}} = 1;
 }
 }