
Java::Javap::Generator::Std - uses TT to spit out Perl 6

useJava::Javap::Generator;
my $gen = Java::Javap::Generator->get_generator( 'Std' );
my $output = $gen->generate(
{
$class_file => 'com.example.InterfaceName',
$ast => $tree,
$javap_flags => $javap_flags,
}
);
where $tree is a Java::Javap abstract syntax tree (AST). Note that parameters are named.

This is a generator which uses TT to make output. It's templates are strings inside this module. To change templates, subclass and override _get_template_for_interface and/or _get_template_for_class.

Call this as a class method on Java::Javap::Generator. Pass it Std to ask it for an instance of this class.
This is the workhorse of this module. It takes information about your java .class file and generates Perl 6 code.
Parameters (these are named, pass them in a hashref, see below):
for documentation, the name of the java .class file
the syntax tree you got from the parser
for documentation, the flags used on the javap command line
Use Java::Javap::Grammar to generate the ast.
Example:
my $parser = Java::Javap::Grammar->new();
my $decomp = `javap com.example.SomeInterface`;
my $tree = $parser->comp_unit( $decomp );
my $jenny = Java::Javap::Generator->get_generator( 'Std' );
my $output = $jenny->generate(
{
class_file => $class_file,
ast => $tree,
}
);
For use by Java::Javap::Generator. You could call it directly, that would bypass the factory.
By default, the TT objects used internally will have this TT constructor parameter:
{ POST_CHOMP => 1 }
Use this accessor to change the TT constructor arguments. You may call this at any time. The new method uses this accessor.
Since generate makes a new TT object for each call, any changes you make via this method will apply to subsequent calls.
Accessr for getting the TT constructor arguments. Mainly for internal use.

Nothing, it's all OO
Java::Javap::Generator
Java::Javap
Java::Javap::Grammar
java2perl6


Copyright (C) 2007, Phil Crow
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.