D
David K. Wall
This is sort of a stealth CGI question. I want to make sure that a
particular CGI program has all the necessary files it needs to run,
and that those files have the appropriate permissions. I'll run
something like the code below. Does anyone have any criticism of this
code, or possibly a suggestion for a better way to go about it?
# these are the desired permissions for each file
my %desired = qw(
program1 r-x
data1 rw-
example rwx
module1 r--
);
foreach my $file (keys %desired) {
my $perm = (-r $file ? 'r' : '-')
. (-w $file ? 'w' : '-')
. (-x $file ? 'x' : '-');
unless ( $perm eq $desired{$file} ) {
print "$file: desired=$desired{$file}, found=$perm\n";
}
}
particular CGI program has all the necessary files it needs to run,
and that those files have the appropriate permissions. I'll run
something like the code below. Does anyone have any criticism of this
code, or possibly a suggestion for a better way to go about it?
# these are the desired permissions for each file
my %desired = qw(
program1 r-x
data1 rw-
example rwx
module1 r--
);
foreach my $file (keys %desired) {
my $perm = (-r $file ? 'r' : '-')
. (-w $file ? 'w' : '-')
. (-x $file ? 'x' : '-');
unless ( $perm eq $desired{$file} ) {
print "$file: desired=$desired{$file}, found=$perm\n";
}
}