Documentation for sub &*chdir

Documentation for sub &*chdir, assembled from the following types:

role IO

From IO

(IO) sub &*chdir

Defined as:

    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 IO::Path representing 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:

    my $*CWD = &*chdir('/tmp');

Use the following, instead; or see indir if you do not need to change process's current directory:

    temp $*CWD;