Skip to content

Commit 3fdc6dc

Browse files
committed
[io grant] Document &*chdir
Hoping there won't any be 'splosions due to the `&*` in the routine's name.
1 parent 1d0e433 commit 3fdc6dc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

doc/Type/IO.pod6

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,29 @@ By default, only C<:d> test is performed.
3939
chdir :r, :w '/tmp'; # … check its .r and .w are True
4040
chdir '/not-there'; # returns Failure
4141
42+
=head2 sub &*chdir
43+
44+
Defined as:
45+
46+
sub &*chdir(IO() $path --> IO::Path:D)
47+
48+
Changes value of C<$*CWD> variable to the provided C<$path> and sets
49+
the process's current directory to the value of
50+
L«C<$path.absolute>|/routine/absolute». B<NOTE:> that in most cases,
51+
you want to use L«C<chdir>|/routine/chdir» routine instead.
52+
53+
Returns L«C<IO::Path>|/type/IO::Path»
54+
representing new C<$*CWD> on success. On failure, returns
55+
L«C<Failure>|/type/Failure» and leaves C<$*CWD> untouched.
56+
The C<$path> can be any any object with an IO method that returns an
57+
L«C<IO::Path>|/type/IO::Path» object.
58+
59+
Note that unlike regular L«C<chdir>|/routine/chdir», there are no arguments
60+
to specify which file tests to perform.
61+
62+
&*chdir('/tmp'); # change $*CWD and process's current directory to '/tmp'
63+
&*chdir('/not-there'); # returns Failure
64+
4265
=head2 sub print
4366
4467
Print the given text on C<$*OUT> (standard output), e.g.:

0 commit comments

Comments
 (0)