noviceuser has asked for the wisdom of the Perl Monks concerning the following question:
i want to write a piece of code say comp.pl where i can pass one or more comma separated directories into a file and use that as INPUT to a called script runTest.pl .
here, directories contains multiple files having testcases
below, $runPath -> path for testcases file / directory containing such file
$runTest -> command line passed testcases file or command line passed directory where such multiple testcases files exist
my $testFile = ''; if (-f "$runPath/$runTest") { $testFile = "$runPath/$runTest"; } else { open (my $RF, '>', 'testFile'); print {$RF} map { "$_\n" } split(/,/, $runTest); close $RF; $testFile = "$runPath/$testFile"; } $status += utils::execCommand(Command => "$runTest.pl -f $testFile;
the above $status line is working fine when passing testFile from command line but not working when passing directory/directories.
example: comp.pl --runTest testDirectory1, testDirectory2so when i am executing the comp.pl script, it is not reading the files and its listed testcases under testDirectory1 and testDirectory2. it is just printing testDirectory1 and testDirectory2 line by line inside <testFile>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pass one or more directories into a file and use that as INPUT to a called script
by hippo (Archbishop) on Aug 13, 2020 at 15:33 UTC | |
|
Re: pass one or more directories into a file and use that as INPUT to a called script
by tybalt89 (Monsignor) on Aug 13, 2020 at 16:17 UTC | |
|
Re: pass one or more directories into a file and use that as INPUT to a called script
by wazat (Monk) on Aug 13, 2020 at 23:06 UTC | |
|
Re: pass one or more directories into a file and use that as INPUT to a called script
by perlfan (Parson) on Aug 13, 2020 at 14:58 UTC |