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"; };
In reply to Re^5: Net::IRC and File::Tail
by Corion
in thread Net::IRC and File::Tail
by naez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |