File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -207,14 +207,14 @@ L«C<unlock>|/routine/unlock» to remove a lock.
207
207
# will wait for the other to finish before proceeding to read/write
208
208
209
209
# Writer
210
- with "foo".IO.open(:w) {
210
+ given "foo".IO.open(:w) {
211
211
.lock;
212
212
.spurt: "I ♥ Perl 6!";
213
213
.close;
214
214
}
215
215
216
216
# Reader
217
- with "foo".IO.open {
217
+ given "foo".IO.open {
218
218
.lock: :shared;
219
219
.slurp.say; # OUTPUT: «I ♥ Perl 6!»
220
220
.close;
@@ -384,7 +384,7 @@ L<in binary mode|/type/IO::Handle#method_encoding>.
384
384
385
385
= begin code :skip-test
386
386
(my $file = 'foo'.IO).spurt: 'I ♥ Perl';
387
- with $file.open {
387
+ given $file.open {
388
388
say .read: 6; # OUTPUT: «Buf[uint8]:0x<49 20 e2 99 a5 20>»
389
389
.close;
390
390
}
@@ -403,7 +403,7 @@ C<X::IO::BinaryMode> exception being thrown.
403
403
404
404
= begin code :skip-test
405
405
(my $file = 'foo'.IO).spurt: 'I ♥ Perl';
406
- with $file.open {
406
+ given $file.open {
407
407
say .readchars: 5; # OUTPUT: «I ♥ P»
408
408
.close;
409
409
}
@@ -565,7 +565,7 @@ block is left.
565
565
# ... do stuff with the file
566
566
}
567
567
568
- with "foo/bar".IO.open(:w) {
568
+ given "foo/bar".IO.open(:w) {
569
569
.spurt: "I ♥ Perl 6!";
570
570
.close;
571
571
}
@@ -594,7 +594,7 @@ Will flush the handle, writing any of the buffered data. Returns C<True>
594
594
on success; otherwise, L < fails|/routine/fail > with C < X::IO::Flush > .
595
595
596
596
= begin code :skip-test
597
- with "foo".IO.open: :w {
597
+ given "foo".IO.open: :w {
598
598
LEAVE .close;
599
599
$fh.print: 'something';
600
600
'foo'.IO.slurp.say; # (if the data got buffered) OUTPUT: «»
You can’t perform that action at this time.
0 commit comments