# New Ticket Created by  "brian d foy" 
# Please include the string:  [perl #130454]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=130454 >


Setting the temporary directory apparently tries to change the current
working directory, which I didn't expect. But, the documentation for
tmpdir doesn't say what it does (https://docs.perl6.org/routine/tmpdir).

    put "Tempdir is " ~ $*TMPDIR;

    {
    my $dir = '/Users/brian/.tmp';
    unless my $rc = tmpdir( '/Users/brian/.not_there' ) {
        my $e = $rc.exception;
        put "unless: Error changing to $dir " ~ $e.^name ~ ': ' ~ $e.message;
        }
    CATCH {
        put "CATCH: Error changing to $dir " ~ .^name;
        }
    }

I expected that tmpdir would return a Failure, and maybe it does if it
doesn't change the current working directory. This may be related to
https://rt.perl.org/Ticket/Display.html?id=130418
("chdir appears to throw exception immediately").

I would only expect things that want to create a temporary file to use
the value of TMPDIR (say, like
https://github.com/perlpilot/p6-File-Temp). I don't need to know where
that is and wouldn't want the current working directory to be there.
I'd rather have the current working directory be the one where my
input files are.

Reply via email to