File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -208,13 +208,20 @@ Return the current position of the file pointer in bytes.
208
208
209
209
= head2 method slurp-rest
210
210
211
- multi method slurp-rest(IO::Handle:D: :$bin! --> Buf)
212
- multi method slurp-rest(IO::Handle:D: :$enc --> Str)
211
+ multi method slurp-rest(IO::Handle:D: :$bin!, :$close --> Buf)
212
+ multi method slurp-rest(IO::Handle:D: :$enc, :$close --> Str)
213
213
214
- Return the remaining content of the file from the current file position
214
+ Returns the remaining content of the file from the current file position
215
215
(which may have been set by previous reads or by C < seek > .) If the
216
216
adverb C < :bin > is provided a L < Buf > will be returned,
217
- otherwise the return will be a C < Str > with the optional encoding C < :enc > .
217
+ otherwise the return value will be a C < Str > with the optional encoding C < :enc > .
218
+ Specifying the adverb C < :close > will cause the filehandle to be closed when
219
+ the call has finished.
220
+
221
+ = for code :skip-test
222
+ my $fh = open("content.txt");
223
+ my $line = $fh.get;
224
+ my $rest-of-file = $fh.slurp-rest(:close);
218
225
219
226
= head2 method Supply
220
227
You can’t perform that action at this time.
0 commit comments