Greetings,
Attempting to prepopulate a select field in the DCT by reading a set of files in a directory within iwmnt. Script works from the cmd line (with $iwWorkareaPath hardcoded) but fails when called from the DCT. Getting a permission denied error at opendir but permissions on the folders are set to 777 from /templatedata down.
ENV:
TS 6.7.1 Linux
Code:
#!/iw-home/teamsite/iw-perl/bin/iwperl
my $iwWorkareaPath = $ENV{'IW_WORKAREA'};
#my $iwWorkareaPath = "/iwmnt/default/main/test/development/WORKAREA/wa1";
$iwWorkareaPath =~ s/\/teamsite_server/iwmnt/i;
$ENV{'NEW_IW_WORKAREA'} = $iwWorkareaPath;
$dir = $ENV{'NEW_IW_WORKAREA'} . "/templatedata/categorytype_1/datatype_1/folder_1/";
opendir(DIR, $dir) || die "can't opendir $dir: $!";
my
@files = readdir DIR;
my $TestFile = "/tmp/TestFile.txt";
open (TESTFILE, ">$TestFile") or die "Can't Open File $TestFile: $!";
print TESTFILE "current dir: $cdir\n";
print TESTFILE "$iwWorkareaPath \n";
print TESTFILE "new env: $ENV{'NEW_IW_WORKAREA'}\n";
print TESTFILE "env: $ENV{'IW_WORKAREA'}\n";
print TESTFILE "arrayCount: $#files\n";
print TESTFILE "argv 0: $ARGV[0]\n";
print TESTFILE "navFiles: $navFiles\n";
print TESTFILE "dir: $dir\n";
print TESTFILE "array of files:
@files\n";
print "\n";
foreach $f (
@files) {
next unless ($f =~ /$ARGV[0]/);
open (FILE, "<$dir/$f") or die "Can't open file: $!";
while () {
chomp;
$_=~s/& /& /g;
($label, $value) = split(/\|/);
print <
END
}
}
print "\n";
Error:
Root cause:
can't opendir /iwmnt/default/main/test/development/WORKAREA/wa1/templatedata/categorytype_1/datatype_1/folder_1/: Permission denied at /iw-home/teamsite/custom/dct/inline_test.ipl line 9.
Directory Permissions:
wa1: 775
templatedata: 777
categorytype_1: 777
datatype_1: 777
folder_1: 777
Thanks in advance!
Regards,