in reply to knowing the current directory

yes Cwd Works fine. but it is very expensive and has to maintain the working directory all time. So use it carefully and only when required. xornand

Replies are listed 'Best First'.
Re: Re: knowing the current directory
by ehdonhon (Curate) on Nov 29, 2001 at 19:02 UTC

    I've had problems with Cwd in the unix environment whenever your process is non-root and is working in a subdirectory of a directory that has the execute bit witout the read bit set.

    My understanding is that Cwd essentially just does a CD .. until it gets to / and then CD's back to where it came from. But, if it can not read every single directory on the way back to / it gets confused.

    There is a way to get Cwd make a system call to /bin/pwd, but if that's all the module is good for, then you might as well just do something like this:

    chomp ( my $dir = `/bin/pwd` );

    There probably is some way to make Cwd always do the right thing. If anybody knows what that is, I'd love to know