I am trying to run a Java program from my Perl script. I would like to avoid using System.exit(1) and System.exit(-1) commands in Java. I am however printing to STDOUT and STDERR from Java. In my Perl script, I am reading from Java's stdout and using that line by line output. How do I print stderr and fail if I ever see stderr? This is what I have so far:
my $java_command = ...;
open(DATA, ">$java_command");
while (<DATA>) {
chomp($_);
....
....
}