The trace is printed to TRACE, not ERROR, so I don't see how you get the trace structure to be redirected in the first.

But if I redirect TRACE in the same manner as you redirected ERROR it works fine in Active Perl 5.8.8 build 817. I'll see about trying other versions. (By the way, there's also TRACECONTEXT. It probably needs redirecting too.)

use strict; use warnings; use Parse::RecDescent; $::RD_ERRORS=1; $::RD_WARN=1; $::RD_HINT=1; $::RD_TRACE=1; open(Parse::RecDescent::ERROR, '>', 'errfile') or die("Can't redirect errors to file 'errfile': $!\n"); open(Parse::RecDescent::TRACE, '>', 'tracefile') or die("Can't redirect errors to file 'tracefile': $!\n"); Parse::RecDescent->new('parse:')->parse('');
>perl 659805a.pl printing code (3018) to RD_TRACE >type errfile Parse::RecDescent: Treating "parse:" as a rule declaration >type tracefile 1| parse |Trying rule: [parse] | 1| parse |Trying production: [] | 1| parse |>>Matched production: []<< | 1| parse |>>Matched rule<< (return value: | | |[parse]) | 1| parse |(consumed: []) |

In any case, it's not an error with Parse::RecDescent. Taking out the relevant bits:

use strict; use warnings; use vars '$tracemsg'; use vars '$tracecontext'; use vars '$tracerulename'; use vars '$tracelevel'; open (TRACE, ">&STDERR"); format TRACE = @>|@|||||||||@^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<| $tracelevel, $tracerulename, '|', $tracemsg | ~~ |^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<| $tracemsg . $tracemsg = 'tracemsg'; $tracecontext = 'tracecontext'; $tracerulename = 'tracerulename'; $tracelevel = 'tracelevel'; write TRACE; open(TRACE, ">tracefile") or die; $tracemsg = 'tracemsg'; $tracecontext = 'tracecontext'; $tracerulename = 'tracerulename'; $tracelevel = 'tracelevel'; write TRACE;
>perl -v This is perl, v5.8.8 built for MSWin32-x86-multi-thread (with 25 registered patches, see perl -V for more detail) Copyright 1987-2006, Larry Wall Binary build 817 [257965] provided by ActiveState http://www.ActiveSta +te.com Built Mar 20 2006 17:54:25 ... >perl 659805b.pl tr|tracerulen|tracemsg | >type tracefile tr|tracerulen|tracemsg |

In reply to Re: Wierd Windows Parse::RecDescent output problem by ikegami
in thread Wierd Windows Parse::RecDescent output problem by dreadpiratepeter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.