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 \*(C`read\*(C') using a single callback that behaves like \*(C`getline\*(C'.

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 from \*(C`getline\*(C', 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 \*(C`getline\*(C' again on this object will return the value of the buffer and return to the normal iterator class.