NAME Parse::RecDescent::Topiary - tree surgery for Parse::RecDescent autotrees SYNOPSIS use Parse::RecDescent::Topiary; my $parser = Parse::RecDescent->new($grammar); ... my $tree = topiary( tree => $parser->mainrule, namespace => 'MyModule::Foo', ucfirst => 1 ); DESCRIPTION Parse::RecDescent has a mechanism for automatically generating parse trees. What this does is to bless each resulting node into a package namespace corresponding to the rule. This might not be desirable, for a couple of reasons: * You probably don't want to pollute the top-level namespace with packages, and you probably don't want your grammar rules to be named according to CPAN naming conventions. Also, the namespaces could collide if an application has two different RecDescent grammars, that share some rule names. * Parse::RecDescent merely blesses the data structures. It does not call a constructor. Parse::RecDescent::Topiary calls "new" for each class. A base class, l is provided in the distribution, to construct hashref style objects. The user can always supply their own - inside out or whatever. topiary This exported function takes a list of option / value pairs: "tree" Pass in the resulting autotree returned by a Parse::RecDescent object. "namespace" Optional prefix to use for package names. "ucfirst" Optional flag to upper case the first character of the rule when forming the class name. "args" Optional user arguments passed in. These are available to the constructors, and the default constructor will put them into the new objects as $self->{args}. BUGS Please report bugs to http://rt.cpan.org AUTHOR Ivor Williams CPAN ID: IVORW ivorw@cpan.org COPYRIGHT This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. SEE ALSO Parse::RecDescent.