Hi, I have a formatting issue while reading a deployment list file in perl and hoping someone would help me out here. Thanks in advance
Details:
we are using Teamsite 6.7.1 and have workflows created out of .wft files. And the deployment task calls a perl file for deploying files.
Before deployment, perl script creates a list of the files to be deployed and each entry is appended by \n. Code looks like this:
$filelist = "D:\\Nagesh\\filelist.$$";
open (LIST, ">$filelist");
foreach $file_to_be_deployed (@iw_files)
{
# REMOVE all from the path but the actual file name
local @brokenpath = ();
@brokenpath = split (/\//, $file_to_be_deployed);
# PRINT the FILENAME to the list and close it
print LIST "$brokenpath[$#brokenpath]\n";
}
close (LIST);
I'm attaching one sample filelist that got created in this fashion (please remove .txt for testing/analyzing)
Issue: immediately after deployment, the perl script reads the same file list and sends an email with the list of the files that got deployed. During this process, while reading the file it is ignoring \n between the files and printing the list as
file 1 file 2 file 3....
Expected outcome is
file 1
file 2
file 3
Another interesting observation is: if I take out the code for reading the file and sending the email to another sample perl file and execute it in the command prompt, the format is coming fine. The read operation is able to consider each file as one line. The issue occurs only when the code gets executed as part of the workflow
Please help me on how I can make the perl script reach each file as one line instead of all files being read as one single line
here is the code to read the file
$filelist = 'd:\Nagesh\filelist.1852';
open(T,$filelist) || die "Can't open file: $!";
my $filesDeployed = "files deployed are<br>";
while (<T>) {
my $pos = index($_,$substrng);
#to remove templatedata\data entry
if ($pos != -1){
$_ = substr($_,0,$pos);
}
$filesDeployed .= "<br>$_";
}
close T;
Considering the attached file, I'm getting the filelist as below in my email
bank\nageshtest\test_revert_process.html templatedata\generic_pages\standard_evergreen_no_rtnav_page\data\testing_revert_process
And the expected outcome in my email is:
bank\nageshtest\test_revert_process.html
templatedata\generic_pages\standard_evergreen_no_rtnav_page\data\testing_revert_process
I dont understand while the file reading operation is behaving different when triggered on command prompt and when triggered through workflow task. Please help!!!