Created
June 25, 2012 15:12
-
-
Save eskatos/2989199 to your computer and use it in GitHub Desktop.
cgi tail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use CGI; | |
use File::Tail; | |
print "Content-type: text/html\n\n"; | |
$| = 1; #set auto flush on | |
# hardcode filename | |
$file_name = "/path/to/file"; | |
# show 100 lines by default | |
$tail_lines=100; | |
$tail_file=File::Tail->new(name=>$file_name, | |
maxinterval=>30, | |
adjustafter=>5, | |
maxbuf=>16384, | |
tail=>$tail_lines); | |
while (defined($readline=$tail_file->read)) | |
{ | |
print $readline."</br>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment