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 modules which are designed to import Java classes into Perl scripts or access Java APIs like Swing, JDBC and JNI.
Below are the ten most important and useful modules 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.
Note: you can install CPAN modules directly from the Internet, by following the instructions provided.
|> Java
This module provides a framework to start a local, or connect to a remote, Java Virtual Machine (JVM). It includes support for VM localisation, 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.
|> Inline::Java
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.
|> Java::Import
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.
|> Java::Build
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.
|> Java::Swing
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.
|> JDBC
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 class.
|> Java::SJ
This module provides a framework to customise 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.
|> Java::JVM::Classfile
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.
|> Template::Plugin::Java
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.
|> Java::JCR::Jackrabbit
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.




1
Andrew Moore - 05/03/08
I thought that perl was a "true" object oriented language, too. What is it (and therefore, what am I) missing? It has polymorphism, multiple inheritance, and all kinds of "objecty" stuff. Is it because the primitives aren't treated as objects?
» Report offensive content
2
George Jempty - 05/03/08
You can certainly undertake new object oriented develoment with Perl, and/or interface with numerous Perl modules in an OO manner if they provide it. But Perl is not *intrinsically* object oriented. You take a variable, typically a data structure like a hash, and you "bless" it, literally with the "bless" keyword. So Perl exposes a lot of the implementation details as to how to actually perform object oriented development with the language. In general exposing implementation details is a bad thing, but in the case of how Perl implement's OO its quite educational. Damian Conway's "Object Oriented Perl", though about 8 years old now, is still a relevant book, since Perl is still on version 5.x. I read this when I only had a couple of years in the field and learned all about closures, which in turn turns out to be very useful if you want to implement OO in some other scripting languages such as Javascript and/or Lua
» Report offensive content
3
Ovid - 07/03/08
Java is not a "true" OO language. You can't call methods on primitives, for example. It's a hybrid OO/procedural language (as evidenced by the fact that many Java "classes" are merely OO wrappers around procedural code). See Smalltalk if you want a "true" OO language. As soon as you understand why Smalltalk doesn't have an 'if' statement, your entire programming world can change for the better.
In fact, one can easily argue that Perl is as "true" an OO language as Java since it implements the basics of OO and lets the developer have the freedom to extend it as needed. Heck, you can even switch from class-based to prototype-based objects, if you prefer. The downside is that it often requires a lot of scaffolding to get this done, but most of that's already available via the CPAN (http://www.cpan.org/). Mind you, I'm not arguing that Perl is better than Java. They each have their strengths and weaknesses. I just saw the second sentence of this article and had to throw an exception :)
» Report offensive content
4
John - 11/04/08
It nice to know that there are great minds out there, i hope you keep up to your task
» Report offensive content