Package DE_EPAGES::Core::API::FileIterator
Reads a file line by line, allows additional processing per line.
Functions
new
Opens a file as an iterator of the lines. Closes the file on desctruction of the iterator. The content to the current line is passed as first parameter to the optional $Handle function.
Syntax |
$Iterator = DE_EPAGES::Core::API::FileIterator->new( $Mode, $FileName ); $Iterator = DE_EPAGES::Core::API::FileIterator->new( $Mode, $FileName, $Handle ); |
Example |
local $/ = "---\n"; my $Iterator = DE_EPAGES::Core::API::FileIterator->new('<', 'LogFile.txt', sub { my $self = shift; my( $Line ) = @_; chomp $Line; return $Line; }); print "'$_'\n" while <Iterator>; |
Input |
|
Return |
|