Re: BSD fixes

[email protected] (Michael G Schwern)
Newsgroups perl.makemaker
Message-ID <[email protected]>
Adriano Ferreira wrote:
> On 9/25/07, Michael G Schwern <[email protected]> wrote:
>> Rafael Garcia-Suarez wrote:
>>> I just committed change 31968 to ExtUtils::MM_Unix to add dragonfly to
>>> the list of BSD-like OSes. See
>>> http://public.activestate.com/cgi-bin/perlbrowse/p/31968
>>>
>>> But while doing so, I noticed that the statement was buggy anyway, so I
>>> fixed that too:
>>> http://public.activestate.com/cgi-bin/perlbrowse/p/31969
>> What was buggy about it?
> 
>      $Is_SunOS   = $Is_SunOS4 || $Is_Solaris;
> -    $Is_BSD     = $^O =~ /^(?:free|net|open)bsd$/ or
> -                  $^O eq 'bsdos' or $^O eq 'interix' or $^O eq 'dragonfly';
> +    $Is_BSD     = $^O =~ /^(?:(?:free|net|open)bsd|bsdos|interix|dragonfly)$/;
> 
> The former would never set $Is_BSD for 'bsdos', 'interix' and
> 'dragonfly' but only evaluate " $^O eq 'foo' " in void context.

Ahh.  I've patched it like this because that regex makes my eyes water.

--- lib/ExtUtils/MM_Unix.pm     (revision 32278)
+++ lib/ExtUtils/MM_Unix.pm     (local)
@@ -35,8 +35,9 @@
     $Is_SunOS4  = $^O eq 'sunos';
     $Is_Solaris = $^O eq 'solaris';
     $Is_SunOS   = $Is_SunOS4 || $Is_Solaris;
-    $Is_BSD     = $^O =~ /^(?:free|net|open)bsd$/ or
-                  $^O eq 'bsdos' or $^O eq 'interix';
+    $Is_BSD     = ($^O =~ /^(?:free|net|open)bsd$/ or
+                   grep( $^O eq $_, qw(bsdos interix dragonfly) )
+                  );


-- 
Robrt:   People can't win
Schwern: No, but they can riot after the game.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.