In Independent routines§
See primary documentation in context for sub &*chdir.
PROCESS::<&chdir> = sub (IO() $path --> IO::Path:D) { }
Changes value of $*CWD variable to the provided $path and sets the process's current directory to the value of $path.absolute. NOTE: that in most cases, you want to use chdir routine instead.
Returns an IO::Path representing the new $*CWD on success. On failure, returns Failure and leaves $*CWD untouched. The $path can be any object with an IO method that returns an IO::Path object.
Note that unlike regular chdir, there are no arguments to specify which file tests to perform.
&*chdir('/tmp'); # change $*CWD and process's current directory to '/tmp' &*chdir('/not-there'); # returns Failure
Note that the following construct is a mistake:
# WRONG! DO NOT DO THIS! my $*CWD = &*chdir('/tmp');
Use the following, instead; or see indir if you do not need to change process's current directory:
temp $*CWD; &*chdir('/tmp');