1Cwd::Guard(3)         User Contributed Perl Documentation        Cwd::Guard(3)
2
3
4

NAME

6       Cwd::Guard - Temporary changing working directory (chdir)
7

SYNOPSIS

9         use Cwd::Guard qw/cwd_guard/;
10         use Cwd;
11
12         my $dir = getcwd;
13         MYBLOCK: {
14             my $guard = cwd_guard('/tmp/xxxxx') or die "failed chdir: $Cwd::Guard::Error";
15             # chdir to /tmp/xxxxx
16         }
17         # back to $dir
18

DESCRIPTION

20       CORE::chdir Cwd:: Guard can change the current directory (chdir) using
21       a limited scope.
22

FUNCTIONS

24       cwd_guard($dir);
25           chdir to $dir and returns Cwd::Guard object. return to current
26           working directory, if this object destroyed.  if failed to chdir,
27           cwd_guard return undefined value. You can get error messages with
28           $Gwd::Guard::Error.
29

AUTHOR

31       Masahiro Nagano <kazeburo {at} gmail.com>
32

SEE ALSO

34       File::chdir, File::pushd
35

LICENSE

37       Copyright (C) Masahiro Nagano
38
39       This library is free software; you can redistribute it and/or modify it
40       under the same terms as Perl itself.
41
42
43
44perl v5.34.0                      2021-07-22                     Cwd::Guard(3)
Impressum