The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

java2perl6api - a Java to Perl 6 API translator

SYNOPSIS

 java2perl6api [options] class_file [...]

 --help          this message
 --outdir=D      root directory for output files (default '.')
 --nonest        don't place output files in nested directories
 --nocompile     don't compile the generated modules into .pir files
 --norecurse     don't recurse into types used by this class
 --set_types=S   replace typemapings with those in file S
 --add_types=S   add/override typemapings with those in file S
 --javapopts=S   a string of command line flags for javap, example:
                    -j '-classpath /some/path'
 --genwith=S     the name of a Java::Javap::Generator:: module
                    which will make the output, defaults to Perl6
 --genopts=S     strings to pass to your --genwith constructor
 --trace=N       defines the trace level (integer value), where:
                    0 means silence, no trace,
                    1 is the default minimum trace messages,
                    >= 9 for full trace

DESCRIPTION

This script is the driver for the Java::Javap module which reads compiled Java files, parses them into a tree, and generates output in Perl 6.

EXAMPLES

To get a single Perl module in the java/sql subdirectory of the current directory with an API translation of java.sql.Connection:

    java2perl6api java.sql.Connection

To get a single Perl module in the current directory with an API for com.example.YourModule whose class file is in /usr/lib/yourjavas:

    java2perl6api --javapopts '-classpath /usr/lib/yourjavas' com.example.YourModule

To put the output from the previous example into the /usr/local/javaapis directory:

    java2perl6api --javapopts '-classpath /usr/lib/yourjavas' \
        --outdir /usr/local/javaapis com.example.YourModule

OPTIONS

--help

Prints a short help message (the same as the SYNOPSIS above).

--javapopts=S

This option takes a single value, you need to quote it. That value is passed directly to javap. -classpath /some/path is the most common value. Be aware that Java::Javap parses the output of javap with a grammar, so some javap flags will cause fatal errors.

--outdir=S

Sets the root directory for output files. Default '.' (current directory).

--nonest

By default output files are written into a directory tree (rooted at --outdir) based on the namespace of the Java package.

Use the --nonest to write all files into the root output directory.

--norecurse

Disable the default behaviour of recursively processing any classes referenced by the specified class.

--nocompile

Disable compiling the generated Perl 6 .pm6 file into a .pir file. (Generating a .pir file takes time but significantly speeds up any future use of the module.)

--trace N

Integer value. Assign zero to it (--trace=0) to silence all messages from the script. 1 is the minimum trace level. An integer >= 9 will emit full trace messages.

--genwith S

Specify the Java::Javap::Generator::* class to use to generate the output files. Defaults to Perl6 (i.e. Java::Javap::Generator::Perl6) which generates Perl 6 roles in .pm6 files.

AUTHOR

Phil Crow <crow.phil@gmail.com> wrote the original verion, further devalopment by Tim Bunce and others since.

COPYRIGHT and LICENSE

Copyright (c) 2007, Phil Crow Copyright (c) 2010, Tim Bunce

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.