Skip Menu |

This queue is for tickets about the File-Tail CPAN distribution.

Report information
The Basics
Id: 32255
Status: open
Priority: 0/
Queue: File-Tail

People
Owner: Nobody in particular
Requestors: mark.zealey [...] pipex.net
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: tell() implimentation
You can create a tell() implimentation for File::Tail using the following sub: sub tell { my $self = shift; $self->{endpos} - length( $self->{buffer} ); }
From: matija+pause [...] serverflow.com
On Fri Jan 11 12:41:32 2008, mark.zealey@pipex.net wrote: Show quoted text
> You can create a tell() implimentation for File::Tail
That is true, but I don't see the point. I'm not going to be providing the seek, so what use is a tell?
Subject: RE: [rt.cpan.org #32255] tell() implimentation
Date: Mon, 14 Jan 2008 09:15:23 -0000
To: <bug-File-Tail [...] rt.cpan.org>
From: "Mark Zealey" <mark.zealey [...] pipex.net>
In this case, I need a tail() implimentation because I've got a File::Tail process going which basically indexes a logfile, but to save on space it doesn't store the contents of the line, only the keywords. Therefore, I want to store an offset to which I can seek() at some point in the future and retrieve the full line. I could keep some line counter inside my program, but tell() seems the best way to solve this problem. Mark
From: mark.zealey [...] pipex.net
Apologies; should more correctly read: sub tell { my $self = shift; $self->{curpos} - length( $self->{buffer} ); }
From: mark.zealey [...] pipex.net
By the way, I also discovered we need a seek implementation so we can resume tailing from the point at which we left off last time. The below works (only for SEEK_SET though): sub seek { my ($self, $position) = @_; # Set the start pointer to the correct position $self->{curpos} = sysseek $self->{handle}, $position, $self->SEEK_SET; # Nuke the buffer $self->{buffer} = ''; }