Cédric Bouvier > Launcher-Cascade > Launcher::Cascade::FileReader::Seekable

Download:
Launcher-Cascade-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

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 ^

SEE ALSO ^

Launcher::Cascade::FileReader

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.

syntax highlighting: