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

Re: [MacPerl] MacPerl and BinHex



On Tue, May 26, 1998 at 03:38:52PM -0700, Greg Aiken wrote:
} I have tried many times to download a Mac BinHex file across the
} internet and onto my PC (since I have a very fast internet connection at
} my office - where I use a PC), I then copy the binhex file onto a PC
} floppy disk and take the floppy home to my Mac (which can of course read
} Mac and PC floppies equally well).  I then use Stuffit Expander to try
} to recreate the original Macintosh file(s) from the binhex file found on
} the PC floppy.  At best, the 'Un-Stuffing' process is a hit-and-miss
} proposition.  Sometimes this works.  Most times it does not.  Sometimes,
} Expander will not even recognize the file as being un-stuffable.
} Othertimes, the file will begin to un-stuff, then the program will hang.

On the chance that it's the line endings, you might want to convert
the file to Mac text before deBinHexing.  Dragging the file off the
floppy before conversion might help, too.  I routinely download BinHex
to my Sun workstation, and although I usually convert it to MacBinary
with mcvert, sometimes I leave it in BinHex form.  I never have
trouble with it, whether I let it be transferred by FTP in text mode
or put it on a floppy with tar.

} 
} 
} 1.  I was wondering if anyone has had similar experience and found a
} solution to this nightmare.
} 
} 2.  More specifically, does there exist a BinHex decoder module that
} works with MacPerl?  Please point me to the direction of this Godsend.

Eryq has written Convert::BinHex, which you can find in CPAN or at
<http://www.enteract.com/~eryq/CPAN/Convert-BinHex/>.  I've written a
front-end to Convert::BinHex, called Mac::Conversions, that enables
you to decode BinHex into a proper Mac file using MacPerl (more
generally, it does Mac <=> BinHex, Mac <=> MacBinary, BinHex <=>
MacBinary).  You can find it at
<http://pobox.com/~schinder/MacPerl.html>.

} 
} 3.  If not, can anyone point me to the algorithm that would allow me to
} write a Perl program to accomplish this feat?

First you have to figure out why it's happening.  BinHex is pretty
bullet proof, but I don't recall whether it's end-of-line agnostic or
not.  First try converting the file to Mac text and decoding on an HFS
or HFS+ drive.

---
Paul Schinder
schinder@pobox.com

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