Prev

Perl Notes

Next

Chapter 9.6 Changing permissions

Wether a file or directory can be accessed - by you, your script, or your visitors - depends on the directory's permissions. You can change a directory's permissions either from the prompt or from within your script, as described here.

To change a file or directory's permissions:

  1. Type chmod(.
  2. Type 0oge, where 0 is a zero, o is the number that indicates the owner permissions, g is the number that indicates the owner's group's permissions, and e is the number that indicates everyone else's permissions.
  3. Type the name of the file or directory whose permissions you want to change.
  4. Repeat step 3 as desired, seperating each element with a coma.
  5. Type ) to complete the function.
  6. Type ; to finsh the line.


if (-e "../tmp/archives") {
  chmod(0777, "../tmp/archives") || @ErrorMessage;
  print "The permissions have been changed.";
}

Tips


Prev Home Next