[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?

  • From: Robin Berjon <robin@k...>
  • To: Giota Karadimitriou <karadim@i...>
  • Date: Tue, 13 Mar 2001 13:42:43 +0100

java execute perl script
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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.