Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

use File::Path; mkpath("../../categories/$cat", 0, 0777); chown 1540, 1540, "../../categories/$cat"; chmod 0777, "../../categories/$cat";
for some reason, the above isn't working.. it creates the directory path just fine, as well as changing the permissions to 0777.. before i added the chmod line though, the permissions stuck at 0755 for some reason.. anyway, I can't get chown to work, it never changes the owner.
any thoughts?

Replies are listed 'Best First'.
Re: change owner & mod
by fs (Monk) on May 31, 2001 at 22:58 UTC
    The permissions most likely started out as 0755 because of your umask is set to 0022 (a common default - man umask for exactly what the umask means)

    As for the ownership, unless you're running the script as root, you probably don't have the permissions to change the ownership of a file - always check your return codes for errors!

Re: change owner & mod
by Anonymous Monk on May 31, 2001 at 23:01 UTC
    mkpath uses mkdir which modifies the permissions with your umask.
Re: change owner & mod
by bluto (Curate) on May 31, 2001 at 23:50 UTC
    Mea culpa... Maybe I should read other folks comments all the way through before replying.