in reply to
Re^3: How to grab Parse::RecDescent error output in a variable?
in thread How to grab Parse::RecDescent error output in a variable?
The reason local breaks it is that local replaces the variable in that lexical scope, and the references to P::RD::ERROR in P/RD.pm are outside the lexical scope of the local invocation (I think).
It's an interesting question though, and IMO the right solution would be to get a patch committed for P::RD that allows the user to specify an alternative filehandle for error output.