I may not be the OP, but this topic does interest me. Is there any easy
way to call a perl script, giving it some string as input? (Without
resorting to Runtime.exec())
Now, if that is possible, how about calling a perl function directly
from java?
And if that is possible, finally how about allowing perl functions
called from java to make callbacks into java?
Is there any solution to the later 2 problems (the first could be
"solved" by just executing the interpreter, but i am looking for some
scripting language to embed in an application)
Juha Laiho - 24 Jan 2006 16:25 GMT
"Stefan Schulz" <schulz.stefan@gmail.com> said:
>I may not be the OP, but this topic does interest me. Is there any easy
>way to call a perl script, giving it some string as input? (Without
[quoted text clipped - 9 lines]
>"solved" by just executing the interpreter, but i am looking for some
>scripting language to embed in an application)
I haven't seen Java and Perl bridged anywhere, but if your need is just
"a scripting language embeddable in Java", you could take a look
at Jython - this should provide for both of your examples above.

Signature
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
IchBin - 24 Jan 2006 19:09 GMT
> I may not be the OP, but this topic does interest me. Is there any easy
> way to call a perl script, giving it some string as input? (Without
[quoted text clipped - 9 lines]
> "solved" by just executing the interpreter, but i am looking for some
> scripting language to embed in an application)
How about:
retVal = (String) xmlrpc.execute( methodName, params );
"Call Perl routines from Java, Use XML-RPC to call Perl routines from
your Java code"
http://www.javaworld.com/javaworld/jw-10-2004/jw-1011-xmlrpc.html
or
" Write CGI programs in Java, Learn how to program the server side of
your Web applications through Java"
http://www.javaworld.com/javaworld/jw-01-1997/jw-01-cgiscripts.html

Signature
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Rogan Dawes - 25 Jan 2006 15:38 GMT
> I may not be the OP, but this topic does interest me. Is there any easy
> way to call a perl script, giving it some string as input? (Without
[quoted text clipped - 9 lines]
> "solved" by just executing the interpreter, but i am looking for some
> scripting language to embed in an application)
Try looking at Apache Bean Scripting Framework, which supports BeanShell
(very Java like), Jython (Python in Java), Groovy, Jacl (Tcl in Java),
Rexx, etc
Using BSF allows the user to choose which scripting language they prefer
to use.
You can always provide a preferred language with your distro . . .
Rogan
Chris Uppal - 25 Jan 2006 16:06 GMT
> Try looking at Apache Bean Scripting Framework, which supports BeanShell
> (very Java like), Jython (Python in Java), Groovy, Jacl (Tcl in Java),
> Rexx, etc
That sounds good. I hadn't heard of it before.
Saves me the effort of replying to Stefan too (I was just about to do so ;-)
BTW, an interesting example of using Jython as the scripting languager
(directly, not via the Apache framework) is GUESS ("The Graph Exploration
System"):
http://graphexploration.cond.org/
-- chris
In my project, for one of my module i implemented in java other three
modules i have implemented in perl..
So i have to run the module developed in java from perl programming..
Is it possible? Kindly reply..
IchBin - 25 Jan 2006 06:54 GMT
> In my project, for one of my module i implemented in java other three
> modules i have implemented in perl..
>
> So i have to run the module developed in java from perl programming..
> Is it possible? Kindly reply..
There is a tutorial that talks about invoking Java from Perl and Perl
from Java here..
http://www.sunsite.ualberta.ca/Documentation/Misc/perl-5.6.1/jpl/docs/Tutorial.html
I do not work with perl all that much but there is a open source project
on Sourceforge call "Inline". This lets you code Java inline in a perl
script. Looks like the same idea as writing inline asem in C.
http://inline.perl.org/java/home.html

Signature
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Roedy Green - 25 Jan 2006 07:16 GMT
> So i have to run the module developed in java from perl programming..
>Is it possible? Kindly reply..
I have already answered what your options are. It really depends on
what the modules do and how much the interact whether what you propose
to do is feasible. If there were all three batch processes that read a
file and write a file there would be no problem at all, for example.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Jeffrey Schwab - 25 Jan 2006 13:54 GMT
> In my project, for one of my module i implemented in java other three
> modules i have implemented in perl..
>
> So i have to run the module developed in java from perl programming..
> Is it possible? Kindly reply..
Double-ended pipes are easy to open in Perl. If you just occasionally
need to grab some output, try system() or backticks.