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

Re: [MacPerl] Generic Search Script



At 08.01 -0500 1999.01.27, RenŽ Laterveer wrote:
>> 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 think Richard meant OS testing in the script in question had only the
purpose that he mentioned.  Yes, $^O is extremely useful.  Many of the
standard modules that come with Perl have, or will have, Mac OS tests built
in.  Socket, IO::Socket, File::Copy, File::Spec, File::Basename, and CPAN
are just a few.  File::Copy uses $^O because they only reasonable way to
copy a file on a Mac is to make sure you get the resource fork, too.  CPAN
uses it for newlines, file paths, and Mac-specific make instructions.
Socket and IO::Socket will use it for Mac-specific sockets (AppleTalk
sockets, in this case).

>    use Config;

>    if ( $Config{'osname'} =~ /^macos/i ) {

You could delete the first line and replace $Config{'osname'} with $^O.
This is probably the best way, as it does exactly what you seem to want:

    if ($^O eq 'MacOS') {

I don't think a regex is needed in any case.

--
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