Leser: 1
|< 1 2 >| | 15 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
dubu@localhost:/test> ls -l
insgesamt 0
drwxr-xr-x 3 dubu users 72 2004-08-10 12:41 bar/
lrwxrwxrwx 1 dubu users 7 2004-08-10 12:41 baz -> bar/foo/
dubu@localhost:/test> perl -MCwd -le 'print getcwd; chdir "baz" or die; print getcwd; chdir ".." or die; print getcwd;'
/test
/test/bar/foo
/test/bar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
=head2 _save_pwd(sub { ... })
=for category File
Save the current directory and assure that outside the block the old
directory will still be valid.
=cut
sub _save_pwd (&) {
my $code = shift;
require Cwd;
my $pwd = Cwd::cwd();
eval {
$code->();
};
my $err = $@;
chdir $pwd or die "Can't chdir back to $pwd: $!";
die $err if $err;
}
|< 1 2 >| | 15 Einträge, 2 Seiten |