#! perl -slw
use strict;
printf "%030d\n", $_ for 1 .. 1e3;
print "Press enter to exit";
And this Perl script to run the above using winopen2(): #! perl -slw
use strict;
use Win32::Socketpair qw[ winopen2 ];
## Run the command and get a bi-direction pipe to it.
my $pipe = winopen2( 'RunMe.pl' );
my @results = <$pipe>;
print $pipe "\n";
print scalar @results;
<STDIN>;
The latter reads a thousand lines from the former, sends "\n" to it which allows it to end, and then prints out the number of lines read (1001 including the "Press Enter to exit prompt") amd waits. If you check the task manager you'll see that the child process has terminated:
[12:05:50.87] C:\test>winopen2-test.pl
1001
[12:06:00.23] C:\test>
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".
|