1: ReturnFileMask returns a filemask obtained by 'stat'
2: to the -rwxrwxrwx format.... please tell me if there
3: is a better way to do this.... We couldn't find one...
4: and it works great in our case
5:
6: sub ReturnFileMask($)
7: {
8: my $Numeric=sprintf "%3o",(shift)&07777;
9: my $Mask='-';
10: foreach(split //,$Numeric)
11: {
12: my $Tmp=$_;
13: my @Pat=qw(r w x);
14: foreach(4,2,1)
15: {
16: (($Tmp-=$_) ge 0) ? ($Mask.=shift @Pat) : ($Mask.="-") && ($Tmp+=$_) && (shift @Pat);
17: }
18: }
19: return $Mask;
20: }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: FileMask Conversion
by btrott (Parson) on May 10, 2000 at 19:58 UTC | |
|
RE: FileMask Conversion
by nuance (Hermit) on May 12, 2000 at 23:41 UTC | |
|
RE: FileMask Conversion
by gnat (Beadle) on May 17, 2000 at 23:21 UTC | |
|
RE: FileMask Conversion
by gnat (Beadle) on May 17, 2000 at 23:24 UTC | |
|
RE: FileMask Conversion
by BBQ (Curate) on May 10, 2000 at 20:41 UTC | |
|
RE: FileMask Conversion
by Anonymous Monk on May 14, 2000 at 22:38 UTC |