sub _debug_fd {
return fileno STDERR unless defined $cur_self;
if ( _debugging && !defined $cur_self->{DEBUG_FD} ) {
my $fd = select STDERR;
$| = 1;
select $fd;
$cur_self->{DEBUG_FD} = POSIX::dup fileno STDERR;
_debug("debugging fd is $cur_self->{DEBUG_FD}\n")
if _debugging_details;
}
return fileno STDERR unless defined $cur_self->{DEBUG_FD};
return $cur_self->{DEBUG_FD};
}
It's called a number of places as follows or similar:
$op->open_pipe( $self->_debug_fd )
It seems it's used to provide a means for post-fork but pre-exec code in the child to display debug messages without causing issues if the child's STDERR is redirected. For example, you wouldn't want some of the debug messages of run \@cmd, "2>", "err.txt" to end up on STDERR and some of them to end up in `err.txt`.
|