-
-
06 Oct 2018 04:36:52 UTC
- Distribution: IO-Handle-Util
- Module version: 0.02
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (5113 / 0 / 0)
- Kwalitee
Bus factor: 1- 72.83% Coverage
- License: perl_5
- Perl: v5.8.0
- Activity
24 month- Tools
- Download (36.58KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
NAME
IO::Handle::Iterator - Iterator based read handle
SYNOPSIS
IO::Handle::Iterator->new(sub { return $next_line; # or undef on eof });
DESCRIPTION
This class lets you define a read handle with a few fallback methods (like
read
) using a single callback that behaves likegetline
.This is similar but much simpler than:
IO::Handle::Prototype::Fallback->new( __read => sub { ... }, );
The reason being that the IO::Handle::Prototype::Fallback implementation will try its very best to behave correctly (i.e. respect the value of
$/
), whereas this implementation assumes it's fine to return things that aren't exactly lines fromgetline
, so the values are just passed through.READ BUFFERING
When a method that requires buffering is invoked the handle is reblessed to a subclass which handles buffering.
Calling
getline
again on this object will return the value of the buffer and return to the normal iterator class.Module Install Instructions
To install IO::Handle::Util, copy and paste the appropriate command in to your terminal.
cpanm IO::Handle::Util
perl -MCPAN -e shell install IO::Handle::Util
For more information on module installation, please visit the detailed CPAN module installation guide.