Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • To be honest, I cut and paste File::Tail options out of a two year old program a co-op developed. I have little (retained) knowledge of what they do. I do know that the module doesn't work exactly the way I expect if I don't use those options, and I do seem to recall that the options that make it do what I want are not the options I would expect.

    --
    J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
    • By the way, while you're thinking about writing your own, I have a File::Tail::Seekable subclass I created for one application. That might be a common desire in any language.

      --
      J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
      • Thanks for the info. While looking at the source, I was befuddled by some of the things he does, but perhaps it will make more sense to me later. Perhaps it's because I settled on a line based approach to reading data over a character based one.

        Here's a brief example of usage in case you're interested:

        t = Tail.new("somefile.txt")

        # To imitate 'tail -f', use a block
        t.tail do |line|
           puts line
        end

        # To simply grab the last X lines, don't use a block
        a = t.tail(20)
        puts a