NAME

ETLp::File::Read - Open a file and read a line when requested

SYNOPSIS

use ETLp::File::Read;

my $fh = ETLp::File::Read->new(
    filename => "/data/comit/final.csv",
);

while (my $line = $fh->get_line) {
    print $fh->line_counter() .": " . $line, "\n";
};

METHODS

new

Create a File object.

Parameters

Hash or hashref consisting of

* directory: optional. The directory where the file resides
* filename: required. Name of the file to be opened. Requires full path
  to the file is the directory is not supplied
* localize: optional. Whether to localize line endings.

Returns

* a ETLp::File::Read object

line_counter

Return the line number last read from the file

Parameters

None

Returns

A postive integer

get_line

gets the next line from the file.

Parameters

None

Returns

A line's content. The Record separator (EOL character) is removed

LICENSE AND COPYRIGHT

Copyright 2010 Redbone Systems Ltd

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

The terms are in the LICENSE file that accompanies this application