So, this works to set RD_TRACE:
perl -MParse::RecDescent -s - -RD_TRACE grammar NewMakepp::Grammar
Unfortunately, it looks like the path taken by the precompilation fails to actually check for undefined rules. This may be a bug, or may have been intentional, I'll have to follow up with Damian.
Even if this were fixed, I'm not sure how useful the '-s' command line option is, as -RD_AUTOSTUB will set $::RD_AUTOSTUB to '1'. An undocumented feature of $::RD_AUTOSTUB is that if it has a boolean-true value, an undefined rule named 'foo' will not get the production
foo: 'foo'
but instead get the production:
foo: $::RD_AUTOSTUB
Which, for -s -RD_AUTOSTUB, will generate:
foo: '1'
1: '1'
Which probably isn't what you wanted in the first place.
Long story short, RD_AUTOSTUB doesn't currently work with precompilation of parsers. You'll have to either not precompile, or define your own stub productions.
Please file a ticket for this issue. I'm out of town for the next week, but will try to get this into a bugfix release next week. I've included details on the issue below, feel free to include them in the bug. You can find the ticket tracker for Parse::RecDescent here:
https://rt.cpan.org/Public/Dist/Display.html?Name=Parse-RecDescent
Note that this isn't unique to the command line, but appears to be a problem with the Precompile method. The callstack is something like:
script: Parse::RecDescent->Precompile($grammar, $class, $sourcefile)
Precompile: $self = Parse::RecDescent->new($grammar,1,$class)
new: $self->Replace($grammar, 1, $class)
Replace: _generate($self, $grammar, 1(fromsplice), 1, $class);
_generate: my ($self, $grammar, $replace, $isimplicit, $isleftop) = (@_, 0);
So, the '1' added to @_ from Precompile in the call to new() ends up becoming $isimplicit.
$isimplicit prevents $self->_check_grammar() from being called, which is the function that does the RD_AUTOSTUB checking/generation. I'll have to look into why _check_grammar is skipped for $isimplicit cases.
There also appears to be another bug here, where the $class parameter gets incorrectly propagated from Precompile into $isleftop inside of _generate, which is probably not correct. Unless I've misread the code somewhere.