in reply to Parse::RecDescent trouble

Well, it is doing what you told it to. This rule
section: server | key
says you have section which have either a server or a key and no more. So it stops as soon as it parses one of these. If you exchange the order of the lines, as in:
print Dumper $parse->section (' tsig-key "/etc/bind/rndc.key" bind-server 127.0.0.1 ');
you're gonna see it parses the tsig-key line correctly but ignores the next one. You need something like that:
section: (server | key)(s)
with some extras to get the data structure you want.

Update: the real problem was spotted by davorg in Re: Parse::RecDescent trouble$parse->section was being used instead of $parse->config. I've got confused by the rule name "section" to hold a single part ("key" or "server"). I expected a config to contain sections and sections to contain (possibly) multiple parts ("key" or "server").

Replies are listed 'Best First'.
Re^2: Parse::RecDescent trouble
by ribasushi (Pilgrim) on Jan 12, 2007 at 12:30 UTC
    Erm isn't this what secion(s) above does? Saying that it should match a number of SECTION while any SECTION can be either SERVER or KEY?