BEGIN { require 'perl5db.pl' }
+=item PERL5SHELL (specific to WIN32 port)
+
+May be set to an alternative shell that perl must use internally for
+executing "backtick" commands or system(). Perl doesn't use COMSPEC
+for this purpose because COMSPEC has a high degree of variability
+among users, leading to portability concerns. Besides, perl can use
+a shell that may not be fit for interactive use, and setting COMSPEC
+to such a shell may interfere with the proper functioning of other
+programs (which usually look in COMSPEC to find a shell fit for
+interactive use).
+
=item PERL_DEBUG_MSTATS
Relevant only if your perl executable was built with B<-DDEBUGGING_MSTATS>,
static char *
GetShell(void)
{
- static char* szWin95ShellEntry = "Win95Shell";
- static char* szWin95DefaultShell = "Cmd32.exe";
- static char* szWinNTDefaultShell = "cmd.exe";
-
if (!ProbeEnv) {
+ char* defaultshell = (IsWinNT() ? "cmd.exe" : "command.com");
+ /* we don't use COMSPEC here for two reasons:
+ * 1. the same reason perl on UNIX doesn't use SHELL--rampant and
+ * uncontrolled unportability of the ensuing scripts.
+ * 2. PERL5SHELL could be set to a shell that may not be fit for
+ * interactive use (which is what most programs look in COMSPEC
+ * for).
+ */
+ char *usershell = getenv("PERL5SHELL");
+
ProbeEnv = TRUE;
- if (IsWin95()) {
- strcpy(szShellPath, szWin95DefaultShell);
- }
- else {
- strcpy(szShellPath, szWinNTDefaultShell);
- }
+ strcpy(szShellPath, usershell ? usershell : defaultshell);
}
return szShellPath;
}