Reputation: 5247
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
Upvotes: 2
Views: 207
Reputation: 34317
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
Upvotes: 1