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

Re: [MacPerl] Porting Un*x perl scripts to MacPerl for CGI



Kent Cowgill <kentc@intersites.com> writes:
}
}Being fully cognizant of the fact that .pdf aren't text files by any
}stretch of the imagination; their _file type code_ is actually 'TEXT' (I
}suppose I wasn't clear on that point in my previous message).  I assume
}MacPerl uses the file's type code to test -T, not (as someone suggested)
}the first few bites of the file.

No, it doesn't use Mac file types, and it would be a bad idea if it did.
Mac file types are completely unreliable, since they are not enforced by
the OS, but are set by whatever program happens to set them, and can be
changed to the wrong thing all sorts of ways.  I have lots of text files on
my disks that aren't TEXT, and some TEXT that aren't text.  I haven't
checked PDF's, but if you say they are TEXT, they are yet another example
of badly typed files.

What Perl does is described in the documentation for the -T flag (page 86
of the Camel, for example); read in a chunk of the beginning of the file
and examine it for textness.  It works well enough in the majority of
cases, but PDF is almost designed to fool it.

}
}
}-Kent
}
}  Kent Cowgill          .---'''''---...         1 West State Street
}  Intersites, Inc.      'i n t e r s i t e s.   Geneva, IL 60134
}  .-'-.-'-.-'-.-'-.-'-.      ''''---.....---'   .-'-.-'-.-'-.-'-.-'-.-'-.
}  kentc@intersites.com                          http://www.intersites.com/


---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us