in reply to state and file perms confusion
From perldoc:
Because the mode contains both the file type and its permissions, you +should mask off the file type portion and (s)printf using a "%o" if y +ou want to see the real permissions. $mode = (stat($filename))[2]; printf "Permissions are %04o\n", $mode & 07777;
You've masked off the file type with $mode = $mode & 07777;, so you'll get 0644 (octal) from the script above when your $mode equals 420 (decimal), since the printf above makes the conversion from decimal to octal.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: state and file perms confusion
by neilwatson (Priest) on Aug 04, 2012 at 01:51 UTC | |
by Kenosis (Priest) on Aug 04, 2012 at 02:18 UTC | |
by Tanktalus (Canon) on Aug 04, 2012 at 13:55 UTC |