Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: mkdir with variable mask

by ctilmes (Priest)
on Jan 26, 2009 at 15:46 UTC ( #738964=note: print w/ replies, xml ) Need Help??


in reply to mkdir with variable mask

I want to create a directory and give it the same permissions as its parent.

Just to go back a step... Why do you want to give it the same permissions as its parent?

Not to say you don't have a good reason, but in general things just work as they ought if you just make the directory and let the OS follow the user's umask and make the directory with defaults.

By explicitly setting permissions, you are often overriding things that the OS and user have set.


Comment on Re: mkdir with variable mask
Re^2: mkdir with variable mask
by kreetrapper (Scribe) on Jan 27, 2009 at 07:43 UTC
    Why do you want to give it the same permissions as its parent?
    Honestly, now that you mention it, I don't really know. Probably I just saw that you could set the permissions with mkdir and thought that I had to. Which is, of course, nonsene. I had a very strange day yesterday anyway, so I just blame my general dizziness for this. ;-)

    Thank you all for your helpful insights. I am not experienced enough at the moment to know what exactly race conditions are, but it seems like a good idea to avoid them, so I will keep that in mind.

    One more question though, regarding linuxer's answer:

    I looked at File::Spec and I wondered whether there is a reason why you are using catfile instead of catdir.

    Alex

      Good point. until now, I used catfile more often than catdir, so it came faster to my mind.

      I will correct my codes accordingly. catdir should be used here.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://738964]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2014-07-11 04:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (218 votes), past polls