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

[MacPerl] Trouble with MacPerl::GetFileInfo



Hi MacPerl Guri,

When using MacPerl::GetFileInfo to get the (creator and) type of a file, I
get results which are (a) inconsistent, and (b) wrong.

Here's a little test script (implemented as an MPW tool):

        ### testinfo -- what's wrong with MacPerl::GetFileInfo?

        Perl -Sx "{0}" {"Parameters"}; Exit {Status}
        #!perl
        use strict;
        foreach (@ARGV) {
                print "$_ == ", scalar MacPerl::GetFileInfo($_), "\n";
                }

Here's a list of files with their types, reported (correctly) by MPW:

        files -x t
        Name                  Type
        --------------------  ----
        AppAliases            Fldr
        Go                    TEXT
        out                   TEXT
        rgrep                 TEXT
        testinfo              TEXT
        textgrep              TEXT
        tgrep                 TEXT

And here's an edited transcript of some tests (I've edited out some
duplicate results; the MPW wildcard character might come out as something
strange on your system).

        testinfo Å
        AppAliases ==
        Go ==
        out ==
        rgrep ==
        testinfo == TEXT
        textgrep == TEXT
        tgrep == TEXT

        testinfo Å
        AppAliases ==
        Go == TEXT
        out == TEXT
        rgrep == TEXT
        testinfo == TEXT
        textgrep == TEXT
        tgrep == TEXT

        testinfo Å
        AppAliases ==
        Go ==
        out == TEXT
        rgrep == TEXT
        testinfo == TEXT
        textgrep == TEXT
        tgrep == TEXT

        testinfo Å
        AppAliases ==
        Go ==
        out ==
        rgrep ==
        testinfo == TEXT
        textgrep == TEXT
        tgrep == TEXT

On the other hand, using -T to test for text files seems to work okay.
(Which probably answers another question I was going to ask before this
problem turned up, viz. did Matthias implement -T with
MacPerl::GetFileInfo, thus obviating the need to read any of the file: not,
it would seem.)

Configuration: LC 575, Mac OS 7.1, 36MB RAM, 2G HD.

Version: perl -e 'print "$]\n"'
         5.004

Any ideas?

- Jason.


___________________________
Dr Jason Johnston
mailto:jcj@mail.usyd.edu.au
http://www-personal.usyd.edu.au/~jcj
fax: +61 2 9519 6184



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