flin2 has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,
I use perl's net::ftp on a Unix platform. It is working perfect. Only problem is that when i fecth mac files (binary) and put them on a Unix system the mac files are corrupted.
Is there a Monk with experience on this problem.
Please help.

Thanks,
flin2

Replies are listed 'Best First'.
Re: fetch mac files with net::ftp
by jonnyfolk (Vicar) on May 15, 2003 at 08:18 UTC
    I use a Mac and Net::FTP without problems, however I only deal in text files.

    I had a quick look at CPAN and found Mac::Macbinary:

    use Mac::Macbinary; $mb = Mac::Macbinary->new(\*FH); # filehandle $mb = Mac::Macbinary->new($fh); # IO::* instance $mb = Mac::Macbinary->new("/path/to/file"); # do validation eval { $mb = Mac::Macbinary->new("/path/to/file", { validate => 1 }); }; $header = $mb->header; # Mac::Macbinary::Header instance $name = $header->name;
    otherwise go to CPAN and type in Mac, you may find something else...
Re: fetch mac files with net::ftp
by erasei (Pilgrim) on May 15, 2003 at 13:30 UTC
    This same problem is likely to happen with any Mac-to-Non-Mac file transfer, regardless of the method used to do the actual transferring. It is caused by the non-Mac dropping the resource fork. Last time I checked this was still a problem up to and including the latest version of Jaguar, as they all use some form of the resource fork. The only method for not losing the resource fork is to compress (tar, gzip, Stuffit, binHex, whatever) the file before transfer.

    If you are storing mac files on a unix machine, you can get a little program called NetaTalk. that will perserve the resource fork on the unix machine. Also more info here