For Programmers: Free Programming Magazines  


Home > Archive > PERL Programming > August 2006 > Taking Perl input from a java app









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Taking Perl input from a java app
bluesteelUT@gmail.com

2006-08-03, 6:57 pm

Hey everyone here is my problem,

I have a Java Program that will wait for user input, and then execute
the command that they put in. What i want to be able to do it automate
the process and write perl scripts to not only startup the java app,
but also to pump it full of commands and also read the output of the
commands once they have been run.

So here is the way i see it in my head working.

The perl script runs the app until the app asks for some input.
The perl script gives it input and waits while the java app processes
the input.
Once the java app finishes, it will output some info that i would like
to read in.
Then the java app will prompt again for more input.
So the perl script gives it more...and so forth until i exit.

I am not clear how to pass the input to the java app when it wants it,
and how to make the perl script wait while the processes it.

Any pointers would help out a lot. (I am running it all on Windows)

Thanks,
Bryan Campbell

mgarrish@gmail.com

2006-08-03, 6:57 pm


bluesteelUT@gmail.com wrote:

> Hey everyone here is my problem,
>
> I have a Java Program that will wait for user input, and then execute
> the command that they put in. What i want to be able to do it automate
> the process and write perl scripts to not only startup the java app,
> but also to pump it full of commands and also read the output of the
> commands once they have been run.
>


Have you had a look at perlipc? In particular, see the section on
bidirectional communication

http://search.cpan.org/~nwclark/per.../> ther_Process

code_wrong

2006-08-04, 9:57 pm


<bluesteelUT@gmail.com> wrote in message
news:1154636485.906128.163310@m73g2000cwd.googlegroups.com...
> Hey everyone here is my problem,
>
> I have a Java Program that will wait for user input, and then execute
> the command that they put in. What i want to be able to do it automate
> the process and write perl scripts to not only startup the java app,
> but also to pump it full of commands and also read the output of the
> commands once they have been run.
>
> So here is the way i see it in my head working.
>
> The perl script runs the app until the app asks for some input.
> The perl script gives it input and waits while the java app processes
> the input.
> Once the java app finishes, it will output some info that i would like
> to read in.
> Then the java app will prompt again for more input.
> So the perl script gives it more...and so forth until i exit.
>
> I am not clear how to pass the input to the java app when it wants it,
> and how to make the perl script wait while the processes it.
>
> Any pointers would help out a lot. (I am running it all on Windows)


This may not be exactly what you want, but it demonstrates (with source
code) a Java applet communicating with a Perl script.
http://www2.sys-con.com/ITSG/Virtua...ella/index.html



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com