| [reply] |
By altering a copy, you won't change the original. The perl program gets its environment and bits and settings from the invoking process, and that one (e.g. a root shell) won't change its mind just because perl is twiddling its own copy of the big picture. There are tricks to swap copy and original, but these involve changing system files. And even so, if you change things behind the back of the program which invoked perl, it just won't notice. For an effective and persistent change of umask usually a new process chain is necessary, starting with login(1).
| [reply] |
If there is a builtin or a function in a preinstalled library, do not start an external program, use the builtin/function.
In most cases it's just a waste of resources, in this particular case it just won't work. The reason is that the umask does something to the shell that executes the command and the programs started later by the shell, not the program that started the shell.
Your Perl script starts a program (/bin/sh or something - the "shell" we've been talking about) and asks it to execute the "umask" command. The shell executes the command, changes ITS OWN user mask and exits.
Jenda
Enoch was right!
Enjoy the last years of Rome.
| [reply] |