[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Broken FileCopy.pl



Hi,

I'm having problems with using FileCopy.pl from the MacPerl library.

I'm running MacPerl 5.0.2.r1m on a 040 Mac.

When I use the version of FileCopy.pl which is provided with the MacPerl 
distribution I only get the first file (of many) copied and the file name 
of the copied file has the extra text "trueDontShowProgress" appended tp 
it.

I can eliminate the extra text on the file name by getting rid of the last 
two argument passed to &FileCopy'FileCopy (see the code below).

I can get FileCopy to work for multiple files if I add a
        &MacPerl'LoadExternals("FileCopy.pl");
within the FileCopy.pl. The error message returned by
&FileCopy'FileCopy before I add the above line of code are of
the form:
        Error : Volume not found
        Error : Volume not found
        Error : Bad Name
        Error : Bad Name
        Error : Folder not found
        Error : Folder not found

I've hacked the FileCopy.pl code (see below) to get it to work but
something appears broken with the XCDM that implements the copy 
routine.

Does anyone have a fix for this or an equivalent routine.

Thanks

Ivars Finvers
finvers@icpd.mitel.com

# snippet of code showing usage of FileCopy ###############

require "FileCopy.pl";

foreach $file (sort @matchedNames) {
        $to = $toDir . $file;
        $from = $fromDir . $file;
        
# This should work with the original version of FileCopy.pl but 
# does not
#       &MacPerl'FileCopy($from, $to,1);
        
# This works with modified FileCopy.pl
        &MacPerl'FileCopy($from, $to);  
}

#end of code snippet

#### copy of (modified) FileCopy.pl ####################
package FileCopy;

&MacPerl'LoadExternals("FileCopy.pl");

package MacPerl;

#
# &MacPerl'FileCopy($from, $to [, $replace [, $dontresolve]])
# 

sub FileCopy {
   local($from, $to, $replace, $dontresolve) = @_;

# not in the original version, but seems to be required if multiple
# FileCopy commands are used.
   &MacPerl'LoadExternals("FileCopy.pl");
   
   if ($replace) {
      $replace = "true";
   } else {
      $replace = "false";
   }

   if ($dontresolve) {
# original version
#     &FileCopy'FileCopy($from, $to, $replace, "DontResolveAlias", 
#         "DontShowProgress");

# version that works
        &FileCopy'FileCopy($from, $to);
        
   } else {
# original version   
#     &FileCopy'FileCopy($from, $to, $replace, "DontShowProgress");

# version that works
        
        &FileCopy'FileCopy($from, $to);
   }
}

1;

### end of FileCopy.pl #################################