Can I use StringTemplate with Perl?
Jonathan Buhacoff writes that he was able to get ST working with Perl easily using Inline::Java module.
#!/usr/bin/perl
use strict;
use warnings;
use Inline
Java => 'STUDY',
STUDY => [ qw(
org.antlr.stringtemplate.StringTemplate
) ],
AUTOSTUDY => 1,
PACKAGE => 'main';
my $t = org::antlr::stringtemplate::StringTemplate->new('hello $name$
');
$t->setAttribute("name","Jonathan");
my $out = $t->toString();
print $out;
This requires Inline::Java to be installed on the system, and for the
CLASSPATH environment variable to include the antlr and stringtemplate
jar files.