Documentation is a bit rough

I've annotated a short test script that was kicking around in my test directory. Maybe it'll clarify things a little?

#! perl -slw use strict; use Win32::Socketpair qw[ winopen2_5 ]; ## Open a pipe to perl.exe -c ## Retrieving the pid and the socket handle my( $pid, $sock ) = winopen2_5( 'perl.exe', '-c' ); ## Print a short script to it for syntax checking print $sock <<'EOP'; my $x = 365.25**3; my $y = qx[ perl -c -e"say 'boo'"; ]; my $z = sub { print $sock <<; my $x = 365.25**3; my $y = qx[ perl -c -e"say 'boo'"; ]; my $z = sub { print $sock <<; my $x = 365.25**3; my $y = qx[ perl -c -e"say 'boo'"; ]; my $z = sub { 1; }; }; }; EOP ## Tell the socket that we have finsihed writing to it ## Has the effect of allowing the pelr process to know ## that no more data is coming, so it can process the script shutdown $sock, 1; ## Read back all the output from the perl process ## -- stdout & stderr -- and display on terminal print while <$sock>; ## Close the socket close $sock; ## Start another copy of perl with a one liner argument ## that outputs to both stdout and stderr ( $pid, $sock ) = winopen2_5( 'perl.exe', q[-E"say 'hello'; warn; die; +"] ); ## Tell the socket we've finished writing shutdown $sock, 1; ## print teh retrieved output to the terminal print while <$sock>; ## and done close $sock; ## The output produced is below __END__ C:\test>winopen2_5 - syntax OK Warning: something's wrong at -e line 1. Died at -e line 1. hello

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^3: Open3 and IO:Select on Win32 by BrowserUk
in thread Open3 and IO:Select on Win32 by Elegant

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.