In the following code I hoped to use `use Cwd abs_path;' to not
only produce the absolute path for a  named directory but to die if it
could not... thereby getting around having to test the named dir with
-d ... to make sure it was really a directory in the fs.

It does not have that effect when a bogus directory is passed in, and,
in fact, goes on to the chdir to find out its bogus.

Why is that?

------- 8< snip ---------- 8< snip ---------- 8<snip -------

#!/usr/local/src/test/bin/perl

use strict;
use warnings;
use Cwd 'abs_path';

my $tdir = shift;

$tdir = abs_path($tdir)  or die "Can't find  <$tdir>: $!";

chdir $tdir or die "Can't chdir <$tdir>: $!";

print "Hello from $tdir\n";


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to