in reply to Re^4: Net::IRC and File::Tail
in thread Net::IRC and File::Tail
My code is different from your code. My code works. I test it as follows:
#!/usr/bin/perl -w my $logfile = "./totte.log"; open my $log, '-|', qw(tail -f), $logfile or die "Couldn't tail logfile '$logfile': $!"; while (<$log>) { chomp; print "Got line >>$_<<\n"; };
Note the order and the lack of whitespace in the second argument to open.
The whole console session is:
osabst@dfrsifc1:/tmp $ cat >totte.log test osabst@dfrsifc1:/tmp $ perl -w tmp.pl Got line >>test<<
This is where I add another line to the logfile from another session
Got line >>test2<< $ cat tmp.pl #!/usr/bin/perl -w my $logfile = "./totte.log"; open my $log, '-|', qw(tail -f), $logfile or die "Couldn't tail logfile '$logfile': $!"; while (<$log>) { chomp; print "Got line >>$_<<\n"; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Net::IRC and File::Tail
by naez (Initiate) on Aug 16, 2007 at 19:18 UTC |