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

Re: [MacPerl] Generic Search Script



Richard asked:

> Am I correct in believing that the only point of testing
> for OS is to use the results to determine the proper path
> separators?

I use OS tests for things that are meant to be fairly
portable, but maybe there's a Mac specific hook that I
would like to have. For instance, I've got a number of
scripts the mutate text files. The way they do this is
that they read from one file, write to another, delete
the first file, and rename the second file to the first.
Pretty typical; but I add in the following lines to make
the new file adopt the type and creator codes of the old
file. The OS tests let my code run equally well on a unix
box where there is no concept of these codes...

> if ($^O =~ /MacOS/i) { ($creator,$type) = MacPerl::GetFileInfo($infnam); }
> unlink $infnam;
> rename($outfnam, $infnam);
> if ($^O =~ /MacOS/i) { MacPerl::SetFileInfo($creator,$type, $infnam); }


This is only one example, but there are a number of similar
instances where I've got Mac specific code in scripts that
run on unix systems...

jay

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