help with qx?

Toby Corkindale tjc at
Wed Feb 6 01:10:53 GMT 2008

On Wed, Feb 06, 2008 at 12:39:20AM +0000, Iain Barnett wrote:
> Hello all,
> Sorry for not mailing to kick the crap out of 
> Perl5/6/MVC/Catalyst/Maypole/Jifty/Mornington Crescent/other mongers..., 
> but I have a small technical question to ask and a room full of perl 
> sceptics (a.k.a C# developers) waiting for a script to cure their build 
> process!
> The script has a system call (to the svn command-line client), and it could 
> possibly return a lot of lines back so I don't want to store it in an 
> array, but process it as it's coming through. Is there a way to force qx or 
> `` into list context, or something equally helpful?

You might find IPC::Open3 / open3 useful here - it spawns the command and gives
you back file handles for stdin, stderr.

If you're just handling, say, stdout, then you might find it simpler to just
use open with the | parameter, ie:

    my $cmd_output = IO::File->new('svn checkout foo |')
        or die("Error: $!");
    while (<$cmd_output>) {
        next unless /thing you're looking for/;
        warn "about stuff\n";

You can find discussion on these topics with 'perldoc perlipc'.


More information about the mailing list