This article is also available as a TechRepublic download.

Just like Perl, Java has been around for a while. However, Perl
is a scripting language and Java
is a true object-oriented language…which perhaps explains why Java and Perl programmers don’t usually hang out at the same bars. This
is a little bit of a shame, because Java and Perl actually inter-operate fairly
well — there are numerous CPAN
which are designed to import Java classes into Perl scripts or
access Java APIs like Swing, JDBC and JNI.

This document lists the ten most important and useful
modules (Table A) in this collection
— take a look, and you might find something useful for the next time you sit
down to write a hybrid Java/Perl application.

You can install CPAN modules directly from the Internet, by following the instructions provided.

Table A

Package Name



This module provides a framework to start a local, or
connect to a remote, Java Virtual Machine (JVM). It includes support for VM
localization, object creation, method invocation, event listeners and loops,
and exceptions.

Use this
module when you need to connect to a local or remote JVM through Perl.


This module is one of the most useful for Java developers
switching over to Perl, because it allows them to embed Java code as-is into
a Perl script. This code is then automatically compiled and invoked as needed
by the Perl interpreter. The module includes support for environment
variables, type casting, shared JVMs, arrays,
objects and exceptions.

Use this
module when you need to embed Java code directly in a Perl script.


This module makes it easy to import and access Java
classes from Perl. It includes the ability to call static methods, pass
arguments and process return values, work with Java-based data structures, and
handle exceptions.

Use this module when you need to access a Java class from
a Perl script.


This module provides an alternative to Ant, the
traditional Java build tool. It combines Perl’s scripting abilities with the
standard Java build/package toolset.

Use this module when you require greater control over the
build/package process for a Java class.


The Swing toolkit provides sophisticated GUI controls
(toolbars, buttons, and selectors) for Java applications. This module
provides an object-based interface to core Swing API calls, and includes
support for extended components, listeners and other wrappers.

Use this module when you need to access Java Swing
functions through Perl.


This module provides an interface to various database
systems using JDBC. It includes support for database connections, query
execution and result set retrieval, prepared statements and error handling.

Use this module when you need to connect to an RDBMS
through a JDBC “pipe”, perhaps to make use of a custom JDBC driver


This module provides a framework to customize Java VM
configuration, making it possible to run multiple VMs,
each with a different startup configuration and service profile.
Configurations are expressed in XML.

Use this module when you need to run multiple Java VMs simultaneously on the same system.


This module reads and parses JVM classfiles
and expresses the information within them as a series of objects. Various
methods are available to retrieve specific information about class methods,
properties and visibility.

Use this module to retrieve detailed information about the
objects and classes defined in a JVM classfile.


This module provides a framework for describing Java
classes in XML and then transforming these XML descriptions into Java source
code. The XML description may include descriptions of variables and methods,
and includes support for type casting and arrays. Two operation modes are
supported: command-line, and embedded within a template.

Use this module when you need to create class templates in
a standard, easily-parseable format, perhaps for
use on different platforms.


This module makes it possible to connect to, and
manipulate, a Jackrabbit (JCR) content repository through Perl. It includes
support for custom nodes.

Use this module when you need to access a Jackrabbit
content repository.