Skip Menu |

This queue is for tickets about the Parse-RecDescent CPAN distribution.

Report information
The Basics
Id: 39323
Status: open
Priority: 0/
Queue: Parse-RecDescent

People
Owner: Nobody in particular
Requestors: vrkosk [...] iki.fi
Cc:
AdminCc:

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



Subject: Impossible to cleanly capture error output
(A related bug is #31076) It is currently impossible to capture Parse::RecDescent error output in a clean way. One way is to redirect STDERR into a (anonymous) filehandle before loading the module by dup'ing STDERR; another is to re-open *Parse::RecDescent::STDERR (say, into an in-memory filehandle) after loading the module and before parsing anything. Neither are very clean solutions, since both require knowledge of package internals. The latter would be clean otherwise, but one cannot use local() since the module uses format(). Details here: http://perlmonks.org/?node_id=710640 Possible solutions: - Accept a parameter either at module level or parser object level that makes Parse::RecDescent die() with the error message instead of printing it. - Or given a filehandle or an object implementing IO::Handle as a parameter, print to that instead of dup'ing STDERR.
Subject: Re: [rt.cpan.org #39323] Impossible to cleanly capture error output
Date: Wed, 17 Sep 2008 09:54:07 +1000
To: bug-Parse-RecDescent [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Ville Rikhard Koskinen via RT wrote: Show quoted text
> It is currently impossible to capture Parse::RecDescent error output in > a clean way.
Not true. It is merely currently *undocumented*. :-) The error messages generated during a parse are stored in $thisparser->{errors}. The demo file demo/demo_errors.pl (included in the distribution) illustrates how to grab those errors cleanly and write them to a file. Damian
Subject: Re: [rt.cpan.org #39323] Impossible to cleanly capture error output
Date: Wed, 17 Sep 2008 09:00:14 +0100
To: bug-Parse-RecDescent [...] rt.cpan.org
From: "Ville Koskinen" <vrkosk [...] iki.fi>
The demos are well hidden on Ubuntu Linux... Thank you, this saved the day. However, it is still a bug in documentation! Also, how stable is the interface?
Subject: Re: [rt.cpan.org #39323] Impossible to cleanly capture error output
Date: Wed, 17 Sep 2008 18:25:32 +1000
To: bug-Parse-RecDescent [...] rt.cpan.org
From: "Damian Conway" <damian [...] conway.org>
Show quoted text
> The demos are well hidden on Ubuntu Linux... Thank you, this saved the > day. However, it is still a bug in documentation!
Indeed. Noted! ;-) Show quoted text
> Also, how stable is the interface?
It's been unchanged since version 1.61 (October 1998). Damian