invoking perl quietly and portably

Stig Brautaset stig at brautaset.org
Mon Feb 20 10:31:42 GMT 2006


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: $! $?";

Any ideas?

Stig

[0] - http://search.cpan.org/dist/Module-Build-Kwalitee/

-- 
"Those who flee temptation generally leave a forwarding address." --  
Lane Olinghouse




More information about the london.pm mailing list