1753297 Members
6878 Online
108792 Solutions
New Discussion юеВ

perl question

 
SOLVED
Go to solution
Ridzuan Zakaria
Frequent Advisor

perl question

Hi,

Can some help explains what permission the below perl command check?

return "Require read permission to the specified directory, $path."
unless (($mode & 004) ||
($uid == $> && $mode & 400) ||
($gid == $) && $mode & 040));

Thanks.
Ridzuan
quest for perfections
4 REPLIES 4
Gary L. Paveza, Jr.
Trusted Contributor
Solution

Re: perl question

Looks like it's checking if you have read permissions.

First line is checking for read permissions for everyone (004), if not, then the second line if you are the owner and have read permissions (400), and if not, the third line if you are a member of the group and have read permissions (040).
Marvin Strong
Honored Contributor

Re: perl question


verifies the user running the script has read permissions to the path. either as other, owner or group.
H.Merijn Brand (procura
Honored Contributor

Re: perl question

which is a rather stupid way of doing so.

-r $path or return "Require read permission to the specified directory, $path.";

would do the same.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Ridzuan Zakaria
Frequent Advisor

Re: perl question

Thanks.
quest for perfections