|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How to execute a perl script in Java?
At 14:18 13/03/2001 +0200, Giota Karadimitriou wrote:
>The URL to the perl script is http://www.w3.org/2000/04/schema_hack/.
>As for the 'but', I didn't want to degrade perl as a language.
>Perl is indeed a great solution for dealing with text but the fact is that I
>need
>java not perl code.
>Still, does anybody know if a perl script can be executed from java?
This is probably not exactly the solution you're looking for but if you're
ok with running JavaServer and aren't afraid of a few lines of Perl code
you might want to look at http://search.cpan.org/search?dist=Java. It's a
complete Perl interface to a local or remote JVM. Something along the lines of:
use Java;
my $java = Java->new;
my $your_app = $java->create_object('gr.iti.yourApp');
$java->do_event($your_app, \&dtd2xsd);
sub dtd2xsd {
my $app = shift;
# call the script from Perl space
# and return the value by setting it on your object
$app->set_field('returnValue',$foo);
}
# simplistic event loop
while(1) {
last if not defined $java->go;
}
It's a bit of a hack because your Java app will have to generate an event
to call the Perl code, and the above Perl program + JavaServer will have to
run continuously if you want to have the functionality available at any
time. Another option you might want to look into is
http://search.cpan.org/search?mode=module&query=jasmin which generates
Jasmin assembler from Perl code but I don't know how complete/stable it is,
and chances are you'll need a fairly recent Perl.
-- robin b.
Always remember you're unique just like everyone else.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








