Mac::AppleSingleDouble - Read Mac files in AppleSingle or AppleDouble format. |
Mac::AppleSingleDouble - Read Mac files in AppleSingle or AppleDouble format.
use Mac::AppleSingleDouble; $foo = new Mac::AppleSingleDouble(shift); $finder_info = $foo->get_finder_info(); print "The file Type is: $finder_info->{'Type'}\n"; print "The file Creator is: $finder_info->{'Creator'}\n"; print "The Finder label color is: $finder_info->{'LabelColor'}\n"; $foo->close();
Perl5 (tested with 5.005_03; may work with older versions of Perl 5), the FileHandle module.
Nothing.
Mac::AppleSingleDouble is a class which knows how to decode the AppleSingle and AppleDouble file formats. An instance of Mac::AppleSingleDouble represents one file on disk.
The structure of Macintosh files is unlike the structure of files on non-Macintosh operating systems. Most operating systems represent a file as a filename (with the file type appended as a suffix), a few attribute bits, and a single chunk of data. Macintosh files consist of a filename, attribute bits, a four-character file type code ('TEXT', 'APPL', 'JPEG', 'PDF ', etc.), a four-character file creator code ('MSWD' for Microsoft Word, '8BIM' for Photoshop, 'SIT!' for StuffIt, etc.), a chunk of unstructured data called the ``Data Fork'', and a chunk of structured data called the ``Resource Fork''. In order to store Macintosh files on other computers, some form of encoding must be used or the resource and attribute information will be lost (which is OK in some cases). MacBinary, BinHex, and AppleSingle all encode the original Mac file in a single chunk of data suitable for export to other operating systems. AppleDouble encodes all the Mac-only data in one file, but leaves the chunk of unstructured data in a separate file all by itself, which allows non-Mac-aware programs to read the unstructured data with no decoding step. AppleSingle and AppleDouble were originally developed for A/UX (an Apple Unix flavor discontinued long ago), and are used by netatalk (an AppleShare file server for Unix servers and Mac clients).
If you are working Mac files on a Mac (presumably with MacPerl), you probably do NOT need this class. If you are working with Mac files on a non-Mac, the files may be encoded in AppleSingle or AppleDouble format, and this class can be useful if you need to get at the Mac file attributes such as the Finder label, the type and creator codes, or the IsInvisible bit.
See the ``AppleSingle/AppleDouble Formats for Foreign Files Developer's Note'' and the book ``Inside Macintosh: Finder Interface'' from Apple Computer, Inc for more details on the formats themselves.
close()
get_finder_info()
get_entry($id)
get_file_format()
is_applesingle()
is_appledouble()
get_entry_descriptors()
get_all_entries()
dump()
dump_header()
dump_entries()
dump_entry($id)
set_labelnames(%new_labelnames)
set_labelcolors(%new_labelcolors)
preload_entire_file()
cache_entries()
The AppleSingle and AppleDouble formats come in two versions - 1 and 2. I was unable to find documentation for version 1 - supposedly there is a manual called ``A/UX Toolbox: Macintosh ROM Interface'', but I was unable to find it. However, netatalk uses version 1. So, this class was coded using the version 2 specification but it was tested on version 1 files written by netatalk. Entry ID 7 appears in version 1 files but I have no idea what it means. However, it seems to work...
This module can read AppleSingle and AppleDouble files, but it cannot create or modify them. It's not worth my time to change it so that it can (testing it thoroughly with other programs which use the files would be very time consuming), so I probably won't do it. If you want to make that enhancement and send your changes to me, I would be happy to integrate them into a new version and to give you credit for your work.
Jamie Flournoy, jamie@white-mountain.org
Mac::AppleSingleDouble - Read Mac files in AppleSingle or AppleDouble format. |