Subject: | Wildcard Characters on Command Line Don't Work |
Date: | Thu, 22 Feb 2018 20:41:25 +0000 (UTC) |
To: | "bug-Perl-Dist-Strawberry [...] rt.cpan.org" <bug-Perl-Dist-Strawberry [...] rt.cpan.org> |
From: | Bill Chatfield <bill_chatfield [...] yahoo.com> |
The following command should list all the files in the current directory, but it just displays the unresolved pattern.
C:\Strawberry\perl\bin>perl -e "print join(qq(\n), @ARGV)" *.*
*.*
This is the way is is supposed to work, running on Windows under MSys:
Bill.Chatfield@LOH001PC0JTPRQ MINGW64 /c/Strawberry/perl/bin
$ perl -e "print join(qq(\n), @ARGV)" *.*
bdf2gdfont.bat
bdf2gdfont.pl
chartex.bat
config_data.bat
...
On Windows it is the responsibility of the application, rather than the shell, to resolve wildcards. I know this functionality is not in Strawberry Perl because the code is ported from UNIX where it is expected that the shell will do it. But a Windows user is going to expect Perl to do this if it is running on Windows. In other words, if Perl is running on Windows it should behave like a Windows application.
I know I can easily write a line or two of code in Perl to work around this problem. But, part of the appeal of Perl is that one can write a minimal amount of code to get things done. I don't want to have to add that piece of code to every script I write. It's just one more thing I have to remember to do every time.
Also, I want my code to work on both Windows and Linux/Mac. So if I add code to every script to handle the wildcards, I then also have to add code to detect Windows and only run the wildcard handling when the script is running on Windows. That is a chunk of extra code that is going to end up being longer than some of my scripts. It kind of goes against why I use Perl.
Anyway, that is why I think it is a bug. Thanks.
-----------------------
System details:
Windows 10
C:\Strawberry\perl\bin>perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for MSWin32-x64-multi-thread