My script runs file when run from a command-line but hangs on the open() call when invoked from Java. No Error is printed out and the print on the following line is never called. Any thoughts on why this would stall on opening the syslog file?
no warnings "all"; use strict; use Net::Dev::Tools::Syslog; my $syslog_file = "tail -n 0 -f /var/log/messages |"; # create syslog parsing object ( $syslog_obj, $error ) = Net::Dev::Tools::Syslog->parse( -report => 1, -parseTag => 1, #-dump => './dump2', -debug => 0, -moreTime => 1, -format => 'noHost', ); unless ($syslog_obj) { printf( "sylog object constructor failed: %s\n", $error ); exit(1); } print STDOUT "Reaches here: $syslog_file \n"; open(FH, "$syslog_file" ) || die "ERROR: open failed: $!\n"; print STDOUT "Doesn't reach here\n"; while (<FH>) { #do whatever } close(FH); sleep 1;
The Java call looks something like this:
Runtime rt = Runtime.getRuntime(); Process proc = null; proc = rt.exec("perl myscript.pl");
In reply to Perl won't Open() when called from Java by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |