Skip to content

Commit bd702e2

Browse files
committed
[io grant] Fix up IO::Handle.comb
- It's no longer lazy-read due to a bug, which likely won't get fixed until we get a proper Cat - routine now has all the same features as Str.comb
1 parent 98965b3 commit bd702e2

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

doc/Type/IO/Handle.pod6

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -273,22 +273,17 @@ mode is undefined.
273273
274274
Defined as:
275275
276-
multi method comb(IO::Handle:D: :$close = False)
277-
multi method comb(IO::Handle:D: Int:D $size, :$close = False)
278-
multi method comb(IO::Handle:D: $comber, :$close = False)
276+
method comb(IO::Handle:D: :$close, |c)
279277
280-
Returns a lazy list of strings combed from the handle, just like C<comb>
281-
on strings.
282-
283-
=for code :skip-test
284-
my $fh = open 'path/to/file', :r;
285-
$fn.comb(/A+/); # Comb file contents by a regex.
286-
287-
or
278+
L<Slurps|/routine/slurp> the handle's content and calls
279+
L«C<Str.split>|/type/Str#routine_comb» on it, forwarding any of the given
280+
arguments. If C<:$close> named parameter is set to C<True>, will
281+
L<close> the invocant after slurping. It is an error to call this method on
282+
a handle opened in binary mode.
288283
289284
=for code :skip-test
290-
my $fh = open 'path/to/file', :r;
291-
$fn.comb(3, close => True); # Comb file contents by 3 characters and close after.
285+
my $fh = 'path/to/file'.IO.open;
286+
say "The file has {+$fh.comb: '♥', :$close} ♥s in it";
292287
293288
=head2 method print
294289

0 commit comments

Comments
 (0)