Skip Menu | will be shut down on March 1st, 2021.

This queue is for tickets about the Devel-Trace CPAN distribution.

Report information
The Basics
Id: 113090
Status: new
Priority: 0/
Queue: Devel-Trace

Owner: Nobody in particular
Requestors: salva [...]

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)


Subject: STDERR may change
Download (untitled) / with headers
text/plain 274b
Hi, In applications that reopen STDERR (in order to redirect the output of some external program, for instance), the output of Devel::Trace may end in the wrong place. The patch attached dups the STDERR file descriptor on startup and then uses it when tracing the program.
Subject: 0001-Duplicate-STDERR-on-startup-in-order-to-avoid-confli.patch
From 764d68ad306274d1cb6b115180c69bc0574dc6dc Mon Sep 17 00:00:00 2001 From: Salvador Fandino <> Date: Wed, 16 Mar 2016 11:27:35 +0100 Subject: [PATCH] Duplicate STDERR on startup in order to avoid conflicts with code that manipulates that file descriptor --- | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ b/ index e8ed796..03f60be 100644 --- a/ +++ b/ @@ -4,12 +4,15 @@ package Devel::Trace; $VERSION = '0.12'; $TRACE = 1; +open OUT, '>&', STDERR; +$oldfh = select(OUT); $| = 1; select($oldfh); + # This is the important part. The rest is just fluff. sub DB::DB { return unless $TRACE; my ($p, $f, $l) = caller; my $code = \@{"::_<$f"}; - print STDERR ">> $f:$l: $code->[$l]"; + print OUT ">> $f:$l: $code->[$l]"; } -- 2.7.0

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to