On Sep 28, 2007, at 5:52 PM, Jim wrote:
# 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 problem is because of a different version of perl, not rmtree()
itself. One version of perl is interpreting your code as
$buildDir->rmtree, 1, 0;
and the other as you intended:
rmtree( $buildDir, 1, 0 );
If you add the parens explicitly, the problem should go away.
-Ken