in reply to Re: Parse::RecDescent
in thread Parse::RecDescent
No, you're right. What's in the top-level curlies ends up being top-level code in the package. My parsers always look like:
use strict; use warnings; my $grammar = <<'__EOI__'; { use strict; use warnings; } ... __EOI__
Note the use of heredocs. Much better than q{} since you don't have to escape some backslashes and some curlies. For example, to have a production match a single backslash,
Single quote heredoc: rule: /\\/
Single quote literal: rule: /\\\/ or rule: /\\\\/
|
---|
In Section
Module Reviews