|
@@ -35,12 +35,21 @@ sub get_frame {
|
35
|
35
|
return $frame;
|
36
|
36
|
}
|
37
|
37
|
|
|
38
|
+sub clear {
|
|
39
|
+ system "cls" if -d "c:\\windows";
|
|
40
|
+ system "clear" if -f "/bin/ls";
|
|
41
|
+}
|
|
42
|
+
|
38
|
43
|
my $file = shift @ARGV or &usage;
|
39
|
44
|
|
40
|
45
|
while (1) {
|
41
|
|
- system("clear");
|
|
46
|
+ &clear;
|
42
|
47
|
printf "[%s] watching: %s\n%s\n", &get_frame(), $file, "=" x 80
|
43
|
48
|
unless $opts->{no_header};
|
44
|
|
- print `cat $file`;
|
|
49
|
+ if (open my $fh, "<", $file) {
|
|
50
|
+ print join "", <$fh>;
|
|
51
|
+ close $file;
|
|
52
|
+ } else { warn "cannot open $file: $!\n"; next; }
|
|
53
|
+} continue {
|
45
|
54
|
sleep $opts->{delay};
|
46
|
55
|
}
|