I didn't say "for complete, 100% portablitity to all possible situations". That line makes the code more portable, which is all that I was claiming.

I think that most users of Unix-like shells on Windows will be using Cygwin Perl which doesn't report $^O as "MSWin32" (especially since using "native Win32" Perl with Cygwin shells has at least a few minor issues).

Also, under Win32, characters like "*" can't be put into file names even if you quote them so the problems with "over glob()ing" under Win32 are smaller than they are for Unix (where they are quite small anyway for most cases -- so I don't suggest you put this code in scripts whose command lines demand a lot of quoting under Unix).

Default Win32 shells/programs don't bypass wildcarding via quoting (in part because the shell doesn't wildcard, in part because the quoting schemes are quite lame, and in part because how to handle spaces in file names was not well thought out), so the only problem is determining the shell.

But I find just checking $^O to be an acceptable level of portability considering how trivial the check is.

I think I'd rather have "native Win32" Perl glob() its command-line arguments by default (like it used to years ago) so that solving this inside the script wouldn't be as attractive -- I see no reason to create extra porting problems for Perl scripts. /: [and add Win32::GetCommandLine() into the base perl.dll for Win32-specific scripts to use, which should cover the only motivation I think of for the current behavior]

        - tye (but my friends call me "Tye")

In reply to (tye)Re2: Script Arguments and Wildcard Expansion under Windows NT by tye
in thread Script Arguments and Wildcard Expansion under Windows NT by mvaline

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.