Java::Javap::Generator - Factory for Perl 6 generators
use Java::Javap::Generator; my $gen = Java::Javap::Generator->get_generator( 'NAME', @args ); my $output = $gen->generate( @more_args );
This is a factory class which returns a Java -> Perl 6 generator. All generators must live in the Java::Javap::Generator:: namespace. They must supply a new and generate methods.
new
generate
To use a particular generator, see its POD.
Java::Javap::Generator::Perl6 - uses TT templates
This moduule provides only one method which returns an instance of the supplied generating class.
Call get_generator with the name of the generator you want to use. Pass any additional arguments expected by the new method of your genertor's class. Example:
get_generator
my $generator = Java::Javap::Generator->get_generator( 'Perl6' );
Each generator must live in the Java::Javap::Generator:: namespace and must implement two methods:
A constructor called by get_generator in this module. Your constructor will receive all of the parameters passed to get_generator, except the name of the subclass (but new is invoked through the fully qualified subclass name, so you get that too).
java2perl6api allows callers to supply these parameters as a string on the command line with the -p (or --genopts) flag, whose value is split on whitespace before the call.
java2perl6api
-p
--genopts
This method returns a single string containing the full text of a Perl module corresponding to the abstract syntax tree of a Java module. Someone else will decide what to do with the output, all you need to do is make the string. See the test files t/02_interface.t and t/03_class.t for examples of the syntax tree data structure.
t/02_interface.t
t/03_class.t
Parameters are supplied to your generate in a single hash reference. These are the ones supplied by the java2perl6api command line tool:
The name of the Java .class file which was run through javap.
The abstract syntax tree made from the class file by Java::Javap::Grammar. Again, see the tests for examples of the tree data structure.
Java::Javap::Grammar
The command line flags passed to javap (like -classpath ...). These are included so you can dump them into a comment in the generated output.
None. Call get_generator as a class method.
All the modules in the Java::Javap::Generator:: namespace.
Phil Crow, <crow.phil@gmail.com>
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.
To install Java::Javap, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Java::Javap
CPAN shell
perl -MCPAN -e shell install Java::Javap
For more information on module installation, please visit the detailed CPAN module installation guide.