|laziness, impatience, and hubris|
Re: why IPC::Open3 can't execute MS-DOS "dir" command?by afoken (Monsignor)
|on Dec 05, 2009 at 13:50 UTC||Need Help??|
Why do you take the pain to run an external program just to get a directory listing? And why do you add extra pain by using Microsofts bug-compatible command interpreter for that task? "If it hurts, stop doing it!"
Perl has opendir, readdir, closedir, stat, and the -X functions that easily allow re-implementing any directory lister in perl. Without the overhead of parsing output that was designed to please the human eye, not to be parsed easily. Without the overhead of creating an external process. Without the problems finding the right external helper program and make it return the expected result.
If you want to work with the files you wanted to get from running the dir builtin (no, it's not a standalone program, it's burried deep inside cmd.exe and another implementation with different behaviour is again burried deep inside command.com), you better have a look at File::Find::Rule, File::Find, and perhaps some other CPAN modules like File::Spec and File::stat.
(Oh, and by the way: Unless you are still running Windows 9x or ME, there is no thing as "DOS" or even "MS-DOS". No NT-based Windows has an underlying DOS.)
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)