develooper Front page | perl.perl5.porters | Postings from June 2008

Re: This Week on perl5-porters - 1-6 June 2008

Thread Previous | Thread Next
From:
Barrie Slaymaker
Date:
June 17, 2008 07:47
Subject:
Re: This Week on perl5-porters - 1-6 June 2008
Message ID:
4857CE7A.1030202@slaysys.com
David, Ed, Jan,

Hi.  IPC::Run original author here.  IPC::Run should not be looked at as 
a system() replacement; it's a thick, heavy convenience module.

An ideal system() replacement should be small and fast with a simple 
system()- or open()-like API.  It should launch one subprocess and, 
ideally, offerSTDIN, STDOUT and STDERR redirection in a perl-friendly 
way. IPC::Run does much more and spends a lot of time and code doing it. 
There are newer, more specifically targeted sub-process management 
modules on CPAN that are what you should use if you only want one 
subprocess and you want to do it quickly.

And if anyone would like to work on getting rid of the helper processes 
on Win32, moving to a Win32 I/O event based architecture in place of 
select() would be nice. The helper processes are a hack done years ago 
to provide Win32 pipes for the child process to read/write and TCP 
sockets for the parent process to use select() on. It seemed to be the 
only technique that worked on Win95/98 and NT 3.51 (IIRC). It smelled 
like a (seemingly necessary) kludge then and isn't any better today.

The need for pipes at the child end is because TCP sockets on Win32 seem 
to lose any unsent data from the child on child exit unless the child 
actually close()es the filehandle, which is not common practice.

Are Win32 pipes select()able now, in modern Windows and/or perls?

- Barrie

Jan Dubois wrote:
> On Sat, 14 Jun 2008, David Landgren wrote:
>   
>> This Week on perl5-porters - 1-6 June 2008
>>
>> "File::Temp" and unsafe shell characters (#50146)
>>
>>    Ed Avis failed to see why anyone still used of "system" when
>>    "IPC::Run" was so much nicer.
>>
>>      'coz it ain't core?
>>      http://xrl.us/b7frr
>>     
>
> There are other reasons too, at least on MSWin32: IPC::Run is rather
> inefficient, starting additional helper processes for each redirected
> file.
>
> In addition to being somewhat slow (which most of the time may not
> be an issue), these helper processes want to execute $^X, which may
> not even be available if you are running a Perl program packaged
> into a self-contained executable with PAR/PerlApp/Perl2Exe.
>
> Therefore IPC::Run isn't really the generic system() replacement.
>
> Cheers,
> -Jan
>
>   


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About