Debian Codegraph @

select_demo

raw
1 #!/usr/bin/perl -w
2 BEGIN { unshift @INC,"./blib/lib/";}
3 use File::Tail 0.91;
4
5 #$name="/var/log/syslog" unless $name=shift @ARGV;
6 $debug=shift @ARGV || 0;
7 $version=shift @ARGV || 0;
8 if ($#ARGV<0) {
9 @ARGV=qw( /var/log/syslog /var/adm/messages /var/adm/lpr.log );
10 }
11 foreach (@ARGV) {
12 push(@files,File::Tail->new(name=>"$_",debug=>$debug));
13 }
14 my $rin='';
15 if ($version==0) {
16 while (1) {
17 $nfound=File::Tail::select(undef,undef,undef,60,@files);
18 unless ($nfound) {
19 my @ints;
20 foreach(@files) {
21 push(@ints,$_->interval);
22 }
23 print "Nothing new! - ".localtime(time)."(".join(",",@ints).")\n";
24 }
25 foreach (@files) {
26 print $_->{"input"}." (".localtime(time).") ".$_->read unless $_->predict;
27 }
28 }
29 } else {
30 while (1) {
31 ($nfound,$timeleft,@pending)=
32 File::Tail::select(undef,undef,undef,60,@files);
33 unless ($nfound) {
34 my @ints;
35 foreach(@files) {
36 push(@ints,$_->interval);
37 }
38 print "Nothing new! - ".localtime(time)."(".join(",",@ints).")\n";
39 }
40 foreach (@pending) {
41 print $_->{"input"}." (".localtime(time).") ".$_->read;
42 }
43 }
44 }