NAME
Launcher::Cascade::FileReader::Seekable - a filereader that memorizes its position between reads.
SYNOPSIS
use Launcher::Cascade::FileReader::Seekable;
my $f = new Launcher::Cascade::FileReader -path => ... ;
my $fh1 = $f->open();
my $line1 = <$fh1>; # first line
$f->close();
# later, in a nearby piece of code
my $fh2 = $f->open(); # different filehandle
my $line2 = <$fh2>; # next line
DESCRIPTION
Launcher::Cascade::FileReader::Seekable inherits from Launcher::Cascade::FileReader but keeps in memory the position where it was at when the filehandle is closed. Subsequent calls to open() will perform the necessary operations to resume reading where it last stopped, be it when reading a local file, or a remote file through ssh.
Attributes
- position
Methods
- close
-
Stores the filehandle's position in the position() attribute, then closes the filehandle.
- open
-
Opens the file (locally or remotely), seeks to the desired position() and returns a filehandle.
BUGS AND CAVEATS
perl
has to be in a directory mentioned in thePATH
environment variable on the remote host, because theseek
operation on remote files is performed with a Perl one-liner.The memorization of the position is performed only when closing the filehandle through the close() method of Launcher::Cascade::FileReader::Seekable, not when closing the filehandle directly:
my $fh = $f->open(); ... # do something with it $f->close(); # right: position() is updated close $fh; # wrong: position() is *not* updated
SEE ALSO
AUTHOR
Cédric Bouvier <cbouvi@cpan.org>
COPYRIGHT & LICENSE
Copyright (C) 2006 Cédric Bouvier, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 139:
Non-ASCII character seen before =encoding in 'Cédric'. Assuming CP1252