in reply to Best practices - absolute paths?

I think using backslashes as path seperators in constant strings is a bigger problem overall; forward slashes work on windows and unix, and you don't have a problem with
$path = "my\new\directory"; # spot the problem here
Anyway, as soon as you're chdir()ing, you have to watch out with relative paths, using threads doesn't really matter.

Replies are listed 'Best First'.
Re^2: Best practices - absolute paths?
by GrandFather (Saint) on Aug 13, 2005 at 05:58 UTC

    Agreed, but watch out for canonpath from File::Spec::Functions - it converts /'s to \'s. Bad for matching actual paths against a constant path!


    Perl is Huffman encoded by design.
Re^2: Best practices - absolute paths?
by Eyck (Priest) on Aug 13, 2005 at 11:32 UTC
    What is wrong/dangerous about chdir'ing?
        Isn't this the whole point of relative paths anyway?
        chdir("some.dir"); open(F,"file");

        All is well, unless of course something changes my CWD between chdir and open.

        If you want to walk different directories, well, you gotta put your seperate codepaths on seperate processess, not threads.