I want to read and write to a process (like tripwire) after polling its o/p, I am working on windows platform, Currently am trying open3 for that but the problem is that the message which Iam sending through "Print $wtr message", to my process is getting lost. here is the code,where I am passing valid date to date command after two invalid one but valid date is not getting accepted third time.
use IPC::Open3; use Symbol; use FileHandle; open ABC,">output.txt"; open DEF,">Eoutput.txt"; $WTR = gensym(); # get a reference to a typeglob $RDR = ">&ABC"; # and another one $ERRR = ">&DEF"; # and another one $pid = open3($WTR, $RDR, $ERRR,'date'); STDIN->autoflush(); STDOUT->autoflush(); ABC->autoflush(); $WTR->autoflush(); print $WTR "3//3//3 \n"; print $WTR "4//4/3 \n"; print $WTR "4/5/3 \n"; waitpid $pid,0;
the o/p which iam getting is
The current date is: Sat 04/05/2003 Enter the new date: (mm-dd-yy) 3//3//34//4/34/5/3 The system cannot accept the date entered. Enter the new date: (mm-dd-yy)
all the three messages r getting concatenated then passed. but If i use "\n" in first print to process statement then i get
The current date is: Sat 04/05/2003 Enter the new date: (mm-dd-yy) 3//3//3 The system cannot accept the date entered. Enter the new date: (mm-dd-yy)
the next two messages are getting lost, the o/p which iam expecting is
The current date is: Sat 04/05/2003 Enter the new date: (mm-dd-yy) 3//3//3 The system cannot accept the date entered. Enter the new date: (mm-dd-yy) 4//4/3 The system cannot accept the date entered. Enter the new date: (mm-dd-yy) 4/5/3

In reply to open3, process sychronization problem by brijeshsnm

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.