That seems like a perl limitation, not a unix one, since there are plenty of ways to do this in perl and without.
For whatever reason, you have to use fork or modules (like IPC::Open3 or whatever) in unix. Actually, why does system(1,$cmd) work at all? I don't see that documented. It's possible I'm blind. I'm cutting down on coffee.
UPDATE: I still don't see how that's a unix problem, rather than a perl one; but I guess I understand your animosity/reciprocity.
UPDATE2 (nov 1st): Your example (in a sibling post) also seems intentionally complex...
use strict;
use warnings;
use IPC::Open3;
use Data::Dumper;
my ($w,$r,$e, @pids);
push @pids, open3($w,$r,$e, qw(ls -al));
push @pids, open3($w,$r,$e, qw(ls -al));
push @pids, open3($w,$r,$e, qw(borked mang));
# tye commented privately that I seem to misunderstand open3, so I jus
+t thought
# I'd mention that I'm perfectly aware I'm screwing up the file handle
+s both by
# reusing them and failing to close them. This is just an example...
+ Perhaps it's
# because the ls doesn't print to stdout? I suppose that isn't the sa
+me as system().
# *shrug*
my @ret = map {[waitpid($_,0) => $?]} @pids;
print "", Dumper(\@ret), "\n";
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|