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

[MacPerl] detecting corrupt resources



Does anyone know how to prevent MacPerl from crashing when it opens the
resource fork of a corrupt file? (So why am I fooling with corrupt files?
These are fonts which reside on the 4300 CD's I am cataloging, so there is
no way to get rid of them.) Anyhow, when I open the resource fork, Perl
crashes immediately with an out of memory error. For example,

    $suitcase = 'Hard Drive:Desktop Folder:Univers Extended'; # corrupt font
    $RFD = OpenResFile ($suitcase); # open the resource fork

It does no good to check if $RFD is defined, because MacPerl crashes as
soon as you open the file. When I try to open it with ResEdit, it says
"Sorry, this file is damaged beyond repair," then quits. Obviously, it's a
pretty bad file.

If crashing can't be prevented, it would be enough to detect that the file
is corrupt; then I could skip over it. I've tried checking the physical and
logical size, but that seems normal. Are there any other ways to get at a
resource fork from MacPerl which might indicate a bad file without crashing?

-Bill




Bill Birkett
Precison Color, Inc.
Plymouth, MI




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