7stud has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I'm trying to understand the IPC::Run docs. Here is how they begin:

## First,a command to run: my @cat = qw( cat ); ## Using run() instead of system(): use IPC::Run qw( run timeout ); run \@cmd, \$in, \$out, \$err, timeout( 10 ) or die "cat: $?"

What the?? How does the command contained in the array @cat ever get executed?

Is there a tutorial somewhere on IPC::Run? I can't find one, and I can't make any sense of the docs.

Replies are listed 'Best First'.
Re: basic IPC::Run question
by almut (Canon) on Nov 25, 2009 at 16:11 UTC

    @cat presumably should be @cmd (or the other way round...).

Re: basic IPC::Run question
by toolic (Bishop) on Nov 25, 2009 at 17:07 UTC
    and I can't make any sense of the docs.
    I learn best by example. The MANIFEST link on the IPC::Run CPAN page shows several scripts in its 'eg' directory, as well as the tests in the 't' directory. Perhaps those will help de-mystify the module.