Преглед на файлове

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;
 }
 }