Skip to content

Commit 894d81a

Browse files
authored
Merge pull request #2609 from treyharris/io-vs-str-example
Make .Str vs .IO example more explicit
2 parents aa8cd77 + 61e4a13 commit 894d81a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/Language/io-guide.pod6

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,10 @@ value of the L«C<$.CWD> attribute|/type/IO::Path#attribute_CWD». For example,
268268
code is broken:
269269
270270
=for code
271-
# WRONG!! .Str DOES NOT USE $.CWD!
272271
my $path = 'foo'.IO;
273272
chdir 'bar';
274-
run <tar -cvvf archive.tar>, ~$path;
273+
# WRONG!! .Str DOES NOT USE $.CWD!
274+
run <tar -cvvf archive.tar>, $path.Str;
275275
276276
The L«C<chdir>|/routine/chdir» call changed the value of the current directory,
277277
but the C<$path> we created is relative to the directory before that change.
@@ -283,9 +283,9 @@ a L«C<Str>|/type/Str» object; they only differ in whether the result is an
283283
absolute or relative path. So, we can fix our code like this:
284284
285285
=for code
286-
# RIGHT!! .absolute does consider the value of $.CWD!
287286
my $path = 'foo'.IO;
288287
chdir 'bar';
288+
# RIGHT!! .absolute does consider the value of $.CWD!
289289
run <tar -cvvf archive.tar>, $path.absolute;
290290
# Also good:
291291
run <tar -cvvf archive.tar>, $path.relative;

0 commit comments

Comments
 (0)