|
NAMEMac::Macbinary - Decodes Macbinary files SYNOPSIS 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;
DESCRIPTIONThis module provides an object-oriented way to extract various kinds of information from Macintosh Macbinary files. METHODSFollowing methods are available. Class method
Instance Method
Following accessors are available via Mac::Macbinary::Header instance.
EXAMPLESome versions of MSIE for Macintosh sends their local files as Macbinary format via forms. You can decode them in a following way: use CGI;
use Mac::Macbinary;
$q = new CGI;
$filename = $q->param('uploaded_file');
$type = $q->uploadInfo($filename)->{'Content-Type'};
if ($type eq 'application/x-macbinary') {
$mb = Mac::Macbinary->new($q->upload('uploaded_file'));
# now, you can get data via $mb->data;
}
COPYRIGHTCopyright 2000 Tatsuhiko Miyagawa <miyagawa@bulknews.net> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. ACKNOWLEDGEMENTMacbinary.pm is originally written by Dan Kogai <dankogai@dan.co.jp>. There are also "Mac::Conversions" and "Convert::BinHex", working kind similar to this module. (However, "Mac::Conversions" works only on MacPerl, and "Convert::BinHex" is now deprecated.) Many thanks to Paul J. Schinder and Eryq, authors of those ones. Macbinary validation is almost a replication of is_macbinary in Mac::Conversions. SEE ALSOperl(1), Mac::Conversions, Convert::BinHex.
|