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

Re: [MacPerl] MacPerl can't Open DOS files (and BinHex)



I now understand the high level format of Mac BinHex format

optional text header lines can include a human readable explanation of the files
contents.
.
(This file must be decoded with BinHex 4.0)<CR>
<CR> optional cr is okay
64 ascii values (<126) in data lines 1 through n-1<CR>
.
1 to 64 ascii values (<126) in data line n<CR>

Additionally, this must be recognized by the Mac OS as being a native Mac file.  All
of this to be found in the data fork of the file, and there should be no resource
fork.

This should be a trivial matter for me to create such a file from the DOS file using
MacPerl.  The main problem being the end of line conversions.  However, there
appears to be one extremely serious limitation with MacPerl that prevents me from
doing this.   The original HQX file that I have is on a DOS formatted diskette,
which the Mac OS is  able to read and write.  MacPerl, on the otherhand, CAN NOT
OPEN a DOS format file!!!  Try it yourself and confirm that;

open PC_FILE, "$ARGV[0]" or die "I don't like PC's";

will indeed print the die message.  Is there a MacPerl fix to this dilema?  I didn't
see anything in the FAQ about this matter.


Mark Manning/Simulacron I wrote:

> There are several problems which you have to deal with when downloading
> text files from the net.  The first is that Carriage Returns (CRs) and
> Linefeeds (LFs) can be included in the file.  Since the Mac only needs
> the CRs, the LFs cause problems.  Another problem which people run into
> all of the time is the difference of downloading a file as a binary file
> instead of as a text file.  It is easy to do since various people use
> various endings on the files and this can cause Netscape and Explorer to
> use alternative methods to transfer the files.
>
> One of the easiest things to do in MacPerl, when you've downloaded a
> binhex file, is to have it compare how long each line is.  Each line of
> a binhex file should be exactly the same length.  I believe the number
> of characters should be 80 per line - but you would have to check that.
> If any of the lines are of a different length (except the last one) then
> you have a problem.
>
> You can also use MacPerl to check the line endings.  The easiest way to
> do this is to just use the CHOMP command, let it get rid of any
> extraneous control characters at the end of the line, and then just
> write everything out with the "\n" character string.
>
> The last thing which you can do to help insure things are well with the
> binhex file is to use MacPerl to check for leading text information.
> There should be nothing before the start of the binhex information.  If
> there is - it can cause problems.
>
> Just a few notes.  :-)
>
> --------------------------------------------------------------------------------
> All e-mail needs to be sent to mark@cheers.jsc.nasa.gov.  If you don't,
> it will
> probably bounce.  What man does not understand or fears; he ultimately
> destroys.
> Steve Wright: Black holes are where God divided by zero.
>
> ***** Want to unsubscribe from this list?
> ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch




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