in reply to Re^4: Fix wildcard arguments under MSWin
in thread Fix wildcard arguments under MSWin
The original of the code had a check for Windows and for the version of the ActiveState Perl that first stopped cleaning up for MS. I had put it in a module and it looked like this.
@main::ARGV = map { /[\*\?]/ ? (glob $_) : ($_) } @main::ARGV if $^O =~ /Win/ && $] > 5.00307;
Over time, this was reduced to the code I originally posted. (Which has now been reduced again.) The funny part is that all of the coditional logic was meant to make it easier to use as a module, so that you did not need to remember the code for the one-liner.
Now, the current version is so small that it's easier to type it in when you need it than keep up with the module and always include it. (Since I usually use it in quicky scripts.) In production code, my command line processing is usually more complete than this.
My original reason for posting the code was to help people who have been bitten by this under Windows. It was one little tool that I have used in the past to help people that had to work under MS Windows and would benefit from Perl.
Thanks to everyone for helping me simplify this code even further.
G. Wade
|
|---|