sandeepda has asked for the wisdom of the Perl Monks concerning the following question:
How can I change above script to dynamically get ANT_HOME inside my testDir?Thanks for suggestionsub getAntHome() { my ($testDir) = @_; my $modulesDir = File::Spec->catfile($testDir, "modules"); my $foundAnt = 0; my $antDir; opendir (DIR, $modulesDir) || die "Error in opening dir $modulesDi +r\n"; while (($filename = readdir(DIR)) and ($foundAnt == 0)){ my $temp1 = rindex $filename, "org.apache.ant_", 1; if ($temp1 == 0) { $antDir = $filename; $foundAnt = 1; } } closedir(DIR); if ($foundAnt) { return File::Spec->catfile($testDir, $antDir); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to find ant home/specific directory in Linux using perl
by Athanasius (Archbishop) on Feb 05, 2014 at 08:37 UTC | |
by sandeepda (Novice) on Feb 05, 2014 at 09:07 UTC | |
by Athanasius (Archbishop) on Feb 05, 2014 at 15:53 UTC | |
|
Re: How to find ant home/specific directory in Linux using perl
by kcott (Archbishop) on Feb 05, 2014 at 08:47 UTC |