Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Perl on OSX > Re: File::Path ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 995 of 1076
Post > Topic >>

Re: File::Path rmtree ****tability (works on OS X, fails on WinXP)

by kenahoo@[EMAIL PROTECTED] (Ken Williams) Sep 28, 2007 at 10:05 PM

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
 




 2 Posts in Topic:
File::Path rmtree portability (works on OS X, fails on WinXP)
subs@[EMAIL PROTECTED] (  2007-09-28 15:52:32 
Re: File::Path rmtree portability (works on OS X, fails on WinXP
kenahoo@[EMAIL PROTECTED]  2007-09-28 22:05:50 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 0:54:52 CST 2008.