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

Re: [MacPerl] Copying files with MacPerl



-----BEGIN PGP SIGNED MESSAGE-----

"Brian L. Matthews" <blm@halcyon.com> writes:
}On Thu, 24 Jul 1997 darrylc@foothills.eznet.com wrote:
}|Is there a way to copy binary files from one folder to another in
}|MacPerl. I know it's easy with text files, but I expect a binary file
}|would require using the Mac's duplication function.
}
}Nah, just use read and print in a loop. Only MS-DOS/Windows machines
}have to worry about binary vs. text files. In fact, on Unix and Macs,
}the following works just fine:
}
}while (defined ($_ = <HANDLE>))
}{
}	print;
}}
}
}whether HANDLE is a filehandle to a text or binary file. The only caveat
}being that sometimes you might be reading and printing single character
}lines, and other times you may be reading and printing monstrously long
}lines. That's why I'd recommend read when you're just copying a file--
}you have control over the size of the chunks read.

Works fine on Unix, but not on Macs running MacOS.  The reason is that this
copies the data fork (to standard output no less, which isn't terribly
useful without a redirect), but not the resource fork.  In order to get the
resource fork, you need to do extra work.  That's why you should use
File::Copy (which works on Unix machines as well), which has been modified
to copy both forks under MacPerl.

}
}Brian
}
}
}***** Want to unsubscribe from this list?
}***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch


- ---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us



-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQB1AwUBM9fyuhCzWM58/rdhAQEkWAL+JAc8RyCTVgBK9hR1mE70zgFTtA+0jgn4
rsAckhmV9EYBAVoW8+butLrBVOhwAThWJj9DSSGSEOqHsO/5Ssl50w+oF+SpID9e
1sTvp6wEajPE8ae7gDKFseytaIK8bkjY
=mqOc
-----END PGP SIGNATURE-----

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch