| Cwd::Guard(3pm) | User Contributed Perl Documentation | Cwd::Guard(3pm) |
Cwd::Guard - Temporary changing working directory (chdir)
use Cwd::Guard qw/cwd_guard/;
use Cwd;
my $dir = getcwd;
MYBLOCK: {
my $guard = cwd_guard('/tmp/xxxxx') or die "failed chdir: $Cwd::Guard::Error";
# chdir to /tmp/xxxxx
}
# back to $dir
CORE::chdir Cwd:: Guard can change the current directory (chdir) using a limited scope.
Masahiro Nagano <kazeburo {at} gmail.com>
File::chdir, File::pushd
Copyright (C) Masahiro Nagano
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| 2022-10-15 | perl v5.36.0 |