From: Jan "Yenya" Kasprzak Date: Sat, 7 May 2011 21:09:17 +0000 (+0200) Subject: LogReader: handle EOF correctly X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;ds=sidebyside;h=8672b2c1cde62799a0ae1fb5431ae898ad0bdab0;p=slotcarman.git LogReader: handle EOF correctly --- diff --git a/SCX/LogReader.pm b/SCX/LogReader.pm index 78d2b50..26aaaaa 100644 --- a/SCX/LogReader.pm +++ b/SCX/LogReader.pm @@ -29,7 +29,10 @@ sub get_data { my ($line, $l_time, @data); do { $line = <$fh>; - return undef if !defined $line; + if (!defined $line) { + print STDERR "End of the log file reached.\n"; + return (); + } chomp $line; $line =~ s/\A\s+//xms; @@ -37,7 +40,10 @@ sub get_data { ($l_time, @data) = split(/\s+/, $line); } while ($l_time < $self->{begin_time}); - return undef if $l_time > $self->{end_time}; + if ($l_time > $self->{end_time}) { + print STDERR "Requested end time reached.\n"; + return (); + } return ($l_time, map { hex $_ } @data); }