2

I have a java code at server side which calls perl at client side and perl calls a java class for validation client side.In server side I expect output message of string type constructed at my client side java class .For calling java class in my perl I am calling like below

 my $command = $java . ' -classpath ' . $classpath . ' ' . $secOptions . ' ' . $className . ' ' . $serviceUrl . ' ' . $composites;
print `$command`;

Can perl call java without System command?The issue is some messages are getting printed which are printed in java class I want to assign output from java class and parse it and send back to my server side

1

1 Answer 1

1

It's difficult to tell from your question exactly what you want to do but this might do the trick

open(my $program, "$command|") or die "$command $!";  #open program on a pipe
my @results=();
while(<$program>) {
  push @results,$_;  # store output
}

For other options see perldoc perlipc http://perldoc.perl.org/perlipc.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.