IO::File::Log

IO::File abstraction on logging files
Download

IO::File::Log Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Luis Mu
  • Publisher web site:
  • http://search.cpan.org/~luismunoz/

IO::File::Log Tags


IO::File::Log Description

IO::File abstraction on logging files Under this discussion, a log file refers to the classical notion of a daemon's log file, that is, a file that can be appended to at any time or that can be "rotated" (ie, the original file can be rename()d and a new file with the same name created in its place).This method provides an abstraction that allows reading operations to occur almost transparently from those files (see CAVEATS later on for more information). The IO::File::Log extension deals with the possibility of the file being rotated, appended to, etc.Note however that the basic assumption for reading a log file, is that it never ends. The general algorythm for this module is as follows:At ->new(), set the file pointer to the beginning of the file and store the file's metadata as object state.At any traditional IO::File operation, perform it on the current file position and store the resulting file ponter's position.At EOF, poll the system to detect a new file with the same name given to ->new() but different metadata. When found, open this new file and fulfill the pending operation in the new file.SYNOPSIS use IO::File::Log; my $fh = new IO::File::Log "mylogfile"; while (my $line = $fh->readline) { # Your code here... } my @remaining = $fh->getlines; Requirements: · Perl


IO::File::Log Related Software