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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.