Argh! No! Please please dont do this!

$^O eq 'Win32'

Code like this is pervasive and wrong. And not only that but holds back implementing proper Win32 OS identification in future versions of perl. Currently the only real way to determine if you are on a W2k box is code like Determine Windows Type or Version. The fact is that this should _not_ be necessary. Instead Perl should know and return the correct value in $^O. But so many people have _hardcoded_ tests like you (and tadman) do in this example and in the perl distribution that loads of tests will fail if it is ever changed and we (Win32 users) all get stuck with b0rked OS reporting. (Yes I started working on getting $^O to return the correct value and decided it wasnt worth the effort changing all those tests. Shudder. They are everywhere.)

At very minimum it makes sense to change the above to the much more flexible and forward compatible

$^O =~/Win32/
to determine that you are on a Win32 box. But even still this test will _not_ tell you if you are on an XP box or a W98 box or....

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.


In reply to $^O eq 'Win32' is a bad idea. by demerphq
in thread use Win2000; and alike by Courage

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.