Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: PERL chmod inconsistent with the LINUX equivalent

by marto (Bishop)
on Nov 22, 2012 at 09:28 UTC ( #1005088=note: print w/replies, xml ) Need Help??

in reply to PERL chmod inconsistent with the LINUX equivalent

This is clearly explained in the chmod documentation, I suggest reading and understanding it.

  • Comment on Re: PERL chmod inconsistent with the LINUX equivalent

Replies are listed 'Best First'.
Re^2: PERL chmod inconsistent with the LINUX equivalent
by ColonelPanic (Friar) on Nov 22, 2012 at 10:12 UTC

    I disagree.

    The problem is that you need a leading zero in order for a number in Perl to be interpreted as octal. That isn't explicitly mentioned in the chmod() documentation, and might not be clear if you don't already know it.

    print 0777 . " (octal)\n"; print 777 . " (decimal)\n";

    When's the last time you used duct tape on a duct? --Larry Wall

      IMHO the chmod documenation is fairly comprehensive.

      "... The first element of the list must be the numeric mode, which should probably be an octal number, and which definitely should not be a string of octal digits: 0644 is okay, but "0644" is not. Returns the number of files successfully changed. See also oct if all you have is a string."

      Note the link to oct, and the fact that the examples clearly show the leading zero. Then follows examples explaining the outcome of several ways of using chmod, including the outcome of using it without the leading zero incorrectly. If you feel this isn't clear enough feel free to contribute to the documentation.

      Update: Strike out mistake.

        Maybe I should have stated that a little less strongly. I don't have a problem with the chmod documentation as such. I just don't think "read the documentation" is the best answer when the documentation doesn't explicitly address the mistake the OP made. The significance of the leading zero might not be clear to someone who doesn't already know what it means.

        When's the last time you used duct tape on a duct? --Larry Wall

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005088]
[erix]: "Nothing in Intelligent Design makes sense except in the light of Creationism" <-- I made that one up myself (free after Dobzhansky )
[erix]: yes. Deplorable marto, deplorable.
[marto]: the situation seemed similar to this one, majority of the contributrions are nonsense, doesn't address any questions ...
[marto]: meh, I've been called worse :P
[marto]: deplorable is actually not bad for this point in the day :P
[erix]: we aim to satisfy
[erix]: churches are good excuses for large-scale architecture -- which is nice
[marto]: not to be confused with Chvrches

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2017-07-28 15:50 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (431 votes). Check out past polls.