10 Oct 1999 20:20:09 UTC
- Distribution: Mac-Conversions
- Module version: 1.04
- Source (raw)
- Browse (raw)
- How to Contribute
- Testers (1 / 0 / 0)
- KwaliteeBus factor: 0
- % Coverage
- License: unknown
- Activity24 month
- Download (53.21KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
Mac::Conversions - A package for common MacOS file encoding/decoding tasks
use Mac::Conversions qw(binhex debinhex macbinary demacbinary macb2hex hex2macb); $converter = Mac::Conversions->new; $converter->binhex("path:to:MacPerl"); $converter->debinhex("path:to:MacPerl.hqx"); $converter->macbinary("path:to:Shuck"); $converter->demacbinary("path:to:Shuck.bin"); $converter->macb2hex("path:to:MacPerl.hqx"); $converter->hex2macb("path:to:MacPerl.bin");
Mac::Conversionsis a class implementing converters for the types of file encoding/decoding routinely done when using MacOS. All of these rely on the presence of the
Mac::Conversionswill not run if
Convert::BinHexis not installed.
The conversions are:
Take the native Macintosh file pointed to by $path and create a BinHex file in the same folder. If the native Macintosh file is named "name", the BinHex file is named "name.hqx", unless "name.hqx" already exists. Then
binhexwill attempt to find a unique name by inserting integers in the name, "name.0.hqx", "name.1.hqx", etc.
Take the BinHex file pointed to by $path and decode it to reconstruct the native Macintosh file. The name of the file will be that encoded into the BinHex file if a file of that name doesn't exist. Otherwise, a unique name will be constructed by adding integers after the name.
Take the native Macintosh file pointed to by $path and create a MacBinaryII file. The name of the MacBinary file will be "name.bin" if the native file is called "name", but
macbinarywill try to find a unique name in the same way that
binhexdoes if a file "name.bin" already exists.
The MacBinary II file pointed to by $path will be decoded to a native Macintosh file. The name of the file will be that encoded into the MacBinary file, except a unique name will be constructed if a file of that name already exists.
The BinHex file $path is converted to a MacBinary file. The name will be "name.bin", where name is the name of the file encoded in the BinHex file, with the usual caveat.
The MacBinary II file $path is converted to BinHex.
This routine uses a simple test to find out if a file is a MacBinary or not. Returns 1 if it is, 0 otherwise. This routine can be fooled, but should be correct almost all of the time.
The constructor for the class. If new is called with Debug => 1
$c = Mac::Conversions->new(Debug => 1);
then semi-useful debugging information will be printed to standard output. If Remove => 1 is set, then the original BinHex or MacBinary (but never a native Mac file) will be unlinked. (Note this means that it doesn't simply get moved to the Trash but disappears forever.)
See the documentation for
Convert::BinHex, where all the heavy lifting is really done.
Copyright 1999, Paul J. Schinder
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install Mac::Conversions, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Mac::Conversions
For more information on module installation, please visit the detailed CPAN module installation guide.