Dear Monks and other seekers!

This is my own reply to the previous questions entitled "Connect gawk via perl to fastagi and asterisk" and "Use of Open2()".

After having looked near and far on the web I finally got back to where I started and must confess that my own question "what have I faild to understand" would better be phrased "what have I faild to read". When I consulted perlfoundations manual on IPC::Open2 closely and the concept of "bareword file handles" I saw an (of me) untested path and after trying I concluded it was the right one.

The part of the script reading

use IPC::Open2; local (*READ, *WRITE); my $pid = open2(\*READ, \*WRITE, "/path/and/bashscript.sh"); #here I tried various ways to "pump" data via *READ and *WRITE but + without success waitpid( $pid, 0 );

should go like this

use IPC::Open2; my $pid = open2(">&STDOUT", "<&STDIN", "/path/and/bashscript.sh"); #bashscript in its turn containing a gawk-script. waitpid( $pid, 0 );

This solves my immediate problems. No "pumping" or otherwise is needed for the communication. It now appears to function correctly between both ends of the dataflow.

Perl is without doubt a powerful language but there are many details to consider for the novice. Therfore I welcome all comments regarding its accuray or usefulness.

Kind regards to you all / Bertil


In reply to Revised: Use of Open2() by wbook
in thread Use of Open2() by wbook

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.