Skip to content

Commit 1d0e433

Browse files
committed
[io grant] Document &chdir
1 parent d050d4b commit 1d0e433

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

doc/Type/IO.pod6

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,36 @@ L<IO::Path|/type/IO::Path>. This is the exception from the rule.
99
1010
=head1 Routines
1111
12+
=head2 sub chdir
13+
14+
Defined as:
15+
16+
sub chdir(IO() $path, :$d = True, :$r, :$w, :$x --> IO::Path:D)
17+
18+
Changes value of C<$*CWD> variable to the provided C<$path>, optionally ensuring
19+
the new path passes several file tests. B<NOTE:> that this routine does I<NOT>
20+
alter the process's current directory (see L«C<&*chdir>|/routine/chdir»).
21+
22+
Returns L«C<IO::Path>|/type/IO::Path»
23+
representing new C<$*CWD> on success. On failure, returns
24+
L«C<Failure>|/type/Failure» and leaves C<$*CWD> untouched.
25+
The C<$path> can be any any object with an IO method that returns an
26+
L«C<IO::Path>|/type/IO::Path» object. The available file tests are:
27+
28+
=item C<:d> — check L«C<.d>|/routine/d» returns C<True>
29+
30+
=item C<:r> — check L«C<.r>|/routine/d» returns C<True>
31+
32+
=item C<:w> — check L«C<.w>|/routine/d» returns C<True>
33+
34+
=item C<:x> — check L«C<.x>|/routine/d» returns C<True>
35+
36+
By default, only C<:d> test is performed.
37+
38+
chdir '/tmp'; # change $*CWD to '/tmp' and check its .d is True
39+
chdir :r, :w '/tmp'; # … check its .r and .w are True
40+
chdir '/not-there'; # returns Failure
41+
1242
=head2 sub print
1343
1444
Print the given text on C<$*OUT> (standard output), e.g.:

0 commit comments

Comments
 (0)