in reply to Re: Perl wait vs Unix ksh wait (spawn)
in thread Perl wait vs Unix ksh wait
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";
-Paul
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Perl wait vs Unix ksh wait (Unix)
by tye (Sage) on Oct 31, 2007 at 18:51 UTC |
In Section
Seekers of Perl Wisdom