NAME
App::RecordStream::InputStream
AUTHOR
Benjamin Bernard <perlhacker@benjaminbernard.com> Keith Amling <keith.amling@gmail.com>
DESCRIPTION
This module will generate an stream of App::RecordStream::Record objects for given inputs.
SYNOPSIS
use App::RecordStream::InputStream;
my $stream = App::RecordStream::InputStream(STRING => $recs_string);
while ( my $record = $stream->get_record() ) {
... do stuff ...
}
CONSTRUCTOR
- my $in = App::RecordStream::InputStream->new(OPTIONS);
-
The input stream takes named parameters, it will take one of: FILE, STRING, or FH (a file handle).
FILE - Name of a file, must be readable STRING - String of new line separated records FH - File handle to a stream of data
Optionally, it wil take a NEXT argument. The NEXT argument should be another InputStream object. Once the returned object reaches the end of its string, it will get records from the NEXT App::RecordStream::InputStream. In this manner, InputStream objects can be chained
returns an instance of InputStream
- my $in = App::RecordStream::InputStream->new_magic()
-
Provides GNU-style input semantics for scripts. If there are arguments left in @ARGV, it will assume those are file names and make a set of chained streams for those files, returning the first stream. If no files are specified, will open an InputStream on STDIN
- my $in = App::RecordStream::InpustStream->new_from_files(FILES)
-
Takes an array of FILES and constructs a set of chained streams for those files. Returns the first stream
PUBLIC METHODS
- my $record = $this->get_record();
-
Retrieve the next App::RecordStream::Record from the stream. Will return a false value if no records are available. If this stream has a NEXT stream specified in the constructor, this will continue to return Record objects until all chained streams are exhausted