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

[MacPerl] File Tests, -T switch



I'm having trouble with the -T file test operator.  I have a set of files
which are mostly text/html.  When I use the file test operators some are
reported as text files and many others are reported as binary.  From the
pod:

"The -T and -B switches work as follows.  The first block or so of the file
is examined for odd characters such as strange control codes or characters
with the high bit set.  If too many odd characters (>30%) are found, it's a
-B file, otherwise it's a -T file.  Also, any file containing null in the
first block is considered a binary file...  Because you have to read a file
to do the -T test, on most occasions you want to use a -f against the file
first, as in next unless -f $file && -T $file."

I examined one of the files that was being reported as binary.  There were
no nulls or high-bit chars. I tried the '-f $file && -T $file' construct
described above, but with the same results.  The file has a resource fork
and is a BBEdit file.  Is there another file condition that can cause the
-T test to fail?

Using
MacPerl 5.1.3r2
OS: tried 7.6.1 and 8.0
PPC

Thanks in advance

John


------------------------------------------------
John Whelan                 ImageLinc Commercial
em: johnw@imagelinc.com     Internet Services
fax: 206.812.1033           ph: 206.812.2662



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