1IO::Handle::Iterator(3pUms)er Contributed Perl DocumentatIiOo:n:Handle::Iterator(3pm)
2
3
4

NAME

6       IO::Handle::Iterator - Iterator based read handle
7

SYNOPSIS

9           IO::Handle::Iterator->new(sub {
10               return $next_line; # or undef on eof
11           });
12

DESCRIPTION

14       This class lets you define a read handle with a few fallback methods
15       (like "read") using a single callback that behaves like "getline".
16
17       This is similar but much simpler than:
18
19           IO::Handle::Prototype::Fallback->new(
20               __read => sub { ... },
21           );
22
23       The reason being that the IO::Handle::Prototype::Fallback
24       implementation will try its very best to behave correctly (i.e. respect
25       the value of $/), whereas this implementation assumes it's fine to
26       return things that aren't exactly lines from "getline", so the values
27       are just passed through.
28

READ BUFFERING

30       When a method that requires buffering is invoked the handle is
31       reblessed to a subclass which handles buffering.
32
33       Calling "getline" again on this object will return the value of the
34       buffer and return to the normal iterator class.
35
36
37
38perl v5.34.0                      2021-07-22         IO::Handle::Iterator(3pm)
Impressum