We are trying to figure out how to start a Java application from a perl script, but still you can periodically read from a STDOUT Java application.
print "running dcmrcv.bat\n"; open my $fh_dcmrcv, "-|", 'z:\apps\dcm4che\dcm4che-2.0.26\bin\dcmrcv.bat \ DCMRCV:11112 -dest z:\dcmrcv -journal z:\dcmrcv', or die "could not execute dcmrcv: $!"; print "dcmrcv.bat started\n";
We wanted to be able to read $ fh_dmcrcv from the file descriptor every few minutes, or perhaps configure the AnyEvent io trigger when there is activity in the file descriptor.
However, when I try to read from a file descriptor, it blocks if I use something like this:
foreach my $line (<$fh_dmcrcv>) { print $line; }
We tried several approaches, we donβt think that we can use File :: Tail, since it seems that the module needs an actual file. The problem is that $ fh_dcmrcv is blocking us when we read from it, I'm not quite sure about the right approach to how to achieve what we want.
EDIT NO. 1
When we run our perl script, we see the output as follows:
Z:\projects\demo_2>process_files.pl running dcmrcv.bat dcmrcv.bat started Start Server listening on port 11112 11:55:13,495 INFO - Start listening on 0.0.0.0/0.0.0.0:11112
script, process_files.pl emits msgs .:
running dcmrcv.bat dcmrcv.bat started
msgs. from the java program: Start the server listening on port 11112 11: 55: 13,495 INFO - Start listening on 0.0.0.0/0.0.0.0:11112
In this case, we echo them only for the sake of this issue, so we want to periodically analyze certain messages. and never repeat them.
Any understanding is understood
-Sam