At 13:20 +0200 2002.05.31, Bart Lateur wrote:
>On Fri, 31 May 2002 13:13:56 +0200, Axel Rose wrote:
>
>>I didn't know that File::Copy::copy() ignores the Mac resource fork. (??)
>
>I don't think it does. It shouldn't. If it does, it's not worthy of its
>name.
Well, that's a matter of opinion. File::Copy provides syscopy(), which
copies files preserving all attributes, including the resource fork. By
default, copy uses syscopy where available (unless copying filehandles).
You can work around it by lying:
use File::Copy;
$File::Copy::Syscopy_is_copy = 1; # this is a lie
copy($file1, $file2);
You can also open the first file to a handle:
use File::Copy;
open my $fh, '<', 'Bourque:Desktop Folder:CSVtext.txt';
copy($fh, 'Bird:CSVtext.txt');
But barring the global variable deception and copying a handle, copy() does
indeed default over to syscopy(), which -- as long as Mac::MoreFiles is
available* -- will do the Right Thing.
So in summary, I'd recommend the second snippet there, which will create a
new file without resource fork data.
*In MacPerls after 5.6.1r1, File::Copy will not *require* Mac::MoreFiles,
but instead will warn if Mac::MoreFiles is not available.
--
Chris Nandor [EMAIL PROTECTED] http://pudge.net/
Open Source Development Network [EMAIL PROTECTED] http://osdn.com/