On Friday, May 10, 2002, at 12:46 , Felix Geerinckx wrote:

> on Wed, 08 May 2002 22:57:18 GMT, [EMAIL PROTECTED] (Drieux) wrote:
>
>> I will confess I was happy to see that the CookBook version
>> used my pet approach of
>>
>>      open(FH, "$cmd |") or die
>>
>> rather than all of this evil FORK child....
>
> But you do realize that Perl is forking anyway, except that in this
> case (as with 'system' and backticks), Perl is doing the waiting on and
> reaping of the children for you automatically.

yes, technically you are correct in the sense that popen() forks
a child process.... I just feel safer with it like that. At that
point it all just looks like the standard 'filter' code model of

        while(<STDIN>) {

        }

But in the case of

        open(FH, "someOneCommand |" ) or die

you are forking only ONE child vice the

        my $cmd = "ps -ef | grep $fremonge | egrep -v grep ";
        open(CMD, "$cmd |" ) or die....

where one is forking 3 children. { and god but I hate to
see that many reconstructions of STDIN/STDOUT as I see it
going through the kernel main loop - I mean that stuff is
like so eighties.... }

Given that I gave up on trying to show more elegant solutions
for the $cmd trick in /bin/sh - with sed/awk things that would
fork only one additional child - that would 'miss itself' in
the proc table.... and getting cranked on by RealProgrammers[tm]
about the evils of /bin/sh and all the forking.... unlike when
as 'c' coders they were burping popens().....

So given that I've stopped trying to be awkard about what is sed,
and just do it simpler in perl..... I figure I'll take up the
holy crusade against the forces of darkness and evil and their
troll kissing side kicks in the perl community....

So yes, their are some 'unresolved' childhood issues here....

8-)


ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to