Matrix Revolutions RSS feeds with ads in them
Nov 08

Bringing Java into Perl

Java, Perl, Tech Add comments

Ahh, so now when I really want to hack some scripts, but have all of this Java code on the business tier, I can just use Inline::Java :) I can play in the loosely coupled world of Perl on the script side… and have all of the benefits of the well designed Java business objects :)

Or I could use Jython. Or BeanShell. Or …..

Read: Bringing Java into Perl

#!/usr/bin/perl
use strict; use warnings;

use Inline Java => <<'EOJ';
public class Hi {

String greeting;

public Hi(String greeting) {
this.greeting = greeting;
}

public void setGreeting(String newGreeting) {
greeting = newGreeting;
}

public String getGreeting() {
return greeting;
}
}
EOJ

my $greeter = Hi->new(”howdy”);
print $greeter->getGreeting(), “\n”;

Comments are closed.