Hi, the great!

I got a problem w/ the pipes that is concluded in necessity to repeat data, sent into pipe in order to achieve the desired action.

In my script i have two parts -- a parent and a child. A parent sends signals to pipe, that are recieved by a process, run by the child -- i.e. pipe is used not between the parent and child, but between parent and another process, that the child creates (the process is the mplayer2).

So, when the parent sends signals (the key pressed by a user) to pipe (to the mplayer2), the mplayer2 not always receives it -- so that the users has to repeat h(is/er) pressings. -- And this is the problem that i want to solve -- to remove the repeatings.

Here is the code (relevant pieces only).

use POSIX qw( mkfifo ); mkfifo( $svitok_truby, 0700 ) || die $svitok_truby.' : '.$!; if( $nomer_vosproizvodyshchego_protsessu=fork ){ # forces a flush right away and after every write or print on the +currently selected output channel. $|=1; system( '/bin/echo \'seek -10\' >'.$svitok_truby ); }else{ system( '/usr/bin/mplayer -slave -input file='.$svitok_truby.' /tm +p/1.flac' ); }

Thank you for help!


In reply to To organize pipe right way. by nikolay

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.