invoking perl quietly and portably

Matt Lawrence matt.lawrence at virgin.net
Mon Feb 20 11:08:18 GMT 2006


Stig Brautaset wrote:
> For the Module::Build::Kwalitee[0] compile test I'm testing perl 
> scripts in ./bin using the following:
> 
>   ok( ! system($Config{perlpath}, "-c", "-Mblib", $script),  "$script" );
> 
> This appears to work, but is a bit more chatty than I'd like. I've 
> skimmed through perlipc but couldn't see a way around this except 
> opening a pipe and redirecting stderr to /dev/null, which seems 
> somewhat unportable:
> 
>   open(SPOOLER, "| $Config{perlpath} -c -Mblib $script 2>/dev/null")
>                            || die "can't fork: $!";
>   local $SIG{PIPE} = sub { die "spooler pipe broke" };
>   close SPOOLER || die "bad spool: $! $?";
> 

use IPC::Open3? Should be better for portability.

Matt


More information about the london.pm mailing list