Subject: | Typo in document pod |
File "lib/Pegex/API.pod":
package Calculator;
use base 'Pegex.Receiver';
sub got_expr {
my ($receiver, $data) = @_;
my ($a, $b) = @$data;
return $a + $b;
}
First of all, instead of 'Pegex.Receiver' must be placed
'Pegex::Receiver'. Secondly, much important, to get correct result of
"2+2" we need rewrite base class like that:
use base qw(Pegex::Tree);
When sub-classing of Pegex::Receiver the $data will contains array ref.
"[1,1,1,1]" in package Calculator above. I do not know why its happens
at this moment, but its a bit annoying when met first time with new
module. It is just does not work properly :)
And execution line from same pod is:
print pegex(grammar, receiver => 'Calculator')->parse('2+2');
Thanks!