I have a bit of a curiosity here with a script I've been working on
and am hoping that some others may have experienced and found a
solution to a similar script portability issue.
The script in question is intended to run on OS X Perl and WinXP
ActiveState PERL.
It seems simple enough
1) test if a directory exists
2) if so, remove it.
The $buildDir variable is set based upon which OS the script is
running on.
For example:
# define build dir path
if ($runOS eq "win"){
$buildDir = "\\\\.PSF\\builds\\$version";
} else {
$buildDir = "/builds/$version";
}
# test for dir and remove if it exists
if ( -d $buildDir) {
# using File::Path here for directory removal
use File::Path;
rmtree $buildDir,1,0;
}
Everything works as expected on OS X, but on WinXP, rmtree seems to
fail with the following error...
Can't call method "rmtree" without a package or object reference
The rmtree method is the only place I seem to have trouble in my script.
Many other operations in the script that use the $buildDir variable
to copy files into the build directory, or move it around, etc work
both on OS X and WinXP.
I'm sure I can work around the problem by just using system(rm -r
$buildDir) and system(del /S $buildDir) ... but I'd like to figure
out if I'm actually doing something wrong with File::Path's rmtree or
if the issue is more because of ActiveState PERL+Windows.
Any ideas out there?
Thanks in advance!
-jim-
-------------------------------------------------------------------
"I gave you five of the best beers of my life...and what did you do?
You drank the sixth one too!"
4ABC 177B 8352 2D6B 1E10 DAE5 7865 34D5 3139 5D2D