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

Re: [MacPerl] Testing for Icon files



At 00.40 -0500 1999.01.28, Ero Brown wrote:
>I have a script that examines every file in a directory.
>I get the following error when my script encounters (tries
>to open) an invisible icon file:
>
># Can't open file MacHD:DevApps:MacPerl:cpan-mac-0.21:blib:lib:Convert:Icon
>
>I've tried doing the following tests on all the files
>in the directory, and the Icon file still falls through
>the filter:
>
>((-e $_) && (-f $_) && (-T $_) && (-r $_))

Do a specific check.  Annoying, but it is only one line, and it will work.

  next if $file eq "Icon\n";

That is if you have the file name only.  If you have a whole path as you do
above, then you can do:

  next if $file =~ /:Icon\n$/;

If you aren't sure which you have, then you could do something like:

  next if $file =~ /(^|:)Icon\n$/;

So Icon will come right after either the beginning of the string or after a
colon.

Oh, and please don't bother mailing me and the rest of the users you sent
it to personally.  Send it to the list, we'll get it just as fast.  Thanks.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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