IPC::Cmd(3p) Perl Programmers Reference Guide IPC::Cmd(3p)
IPC::Cmd(3p) Perl Programmers Reference Guide IPC::Cmd(3p) # IPC::Cmd(3p) Perl Programmers Reference Guide IPC::Cmd(3p) NNAAMMEE # IPC::Cmd - finding and running system commands made easy SSYYNNOOPPSSIISS # use IPC::Cmd qw[can_run run run_forked]; my $full_path = can_run('wget') or warn 'wget is not installed!'; ### commands can be arrayrefs or strings ### my $cmd = "$full_path -b theregister.co.uk"; my $cmd = [$full_path, '-b', 'theregister.co.uk']; ### in scalar context ### my $buffer; if( scalar run( command => $cmd, verbose => 0, buffer => \$buffer, timeout => 20 ) ) { print "fetched webpage successfully: $buffer\n"; } ### in list context ### my( $success, $error_message, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 ); if( $success ) { print "this is what the command printed:\n"; print join "", @$full_buf; } ### run_forked example ### my $result = run_forked("$full_path -q -O - theregister. ...