R. Joseph Newton wrote:
[EMAIL PROTECTED] wrote:


I'm writing a file browser script.  I've learned about chmod and unix
permission numbers and what they represent.  But how do I determine the
owner,  group and other permission settings.

Is there a perl module that makes this chore easy?

Thanks
Tricia


There are a few.  If you are interested specifically in the Unix permission
model, though, you might want to work with the output of the ls -al
command.  The permission string is at the left of each line returned, and
has 10 characters, first the directory, then the r [read] w [write] and x
[execute] permissions for owner, group and world respectively.

By taking the substring from each line, then, you can parse each for the
permission appropriate to each category.

This is the *wrong* way to approach getting the permissions for the file, the 'stat' builtin will do the same thing and does not require shelling out nor screen scraping.


perldoc -f stat
perldoc File::stat

http://danconia.org


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to