PL_perlio_debug_fd
= PerlLIO_open3(s, O_WRONLY | O_CREAT | O_APPEND, 0666);
else
- PL_perlio_debug_fd = -1;
+ PL_perlio_debug_fd = PerlLIO_dup(2); /* stderr */
} else {
- /* tainting or set*id, so ignore the environment, and ensure we
- skip these tests next time through. */
- PL_perlio_debug_fd = -1;
+ /* tainting or set*id, so ignore the environment and send the
+ debug output to stderr, like other -D switches. */
+ PL_perlio_debug_fd = PerlLIO_dup(2); /* stderr */
}
}
if (PL_perlio_debug_fd > 0) {
unless $::Config{ccflags} =~ /DEBUGGING/
or $^O eq 'VMS' && $::Config{usedebugging_perl} eq 'Y';
-plan tests => 6;
+plan tests => 8;
END {
unlink $perlio_log;
ok(-e $perlio_log, "... perlio debugging file found with -Di and PERLIO_DEBUG");
unlink $perlio_log;
- fresh_perl_is("print qq(hello\n)", "\nEXECUTING...\n\nhello\n",
+ fresh_perl_like("print qq(hello\n)", qr/define raw/,
{ stderr => 1, switches => [ "-TDi" ] },
- "No perlio debug file with -T..");
+ "Perlio debug output to stderr with -TDi (with PERLIO_DEBUG)...");
ok(!-e $perlio_log, "...no perlio debugging file found");
}
+
+{
+ local $ENV{PERLIO_DEBUG};
+ fresh_perl_like("print qq(hello)", qr/define raw/,
+ { stderr => 1, switches => [ '-Di' ] },
+ "-Di defaults to stderr");
+ fresh_perl_like("print qq(hello)", qr/define raw/,
+ { stderr => 1, switches => [ '-TDi' ] },
+ "Perlio debug output to STDERR with -TDi (no PERLIO_DEBUG)");
+}
+