IPC::Cmd

Finding and running system commands made easy
Download

IPC::Cmd Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Publisher Name:
  • Chris Williams
  • Publisher web site:
  • http://search.cpan.org/~bingos/

IPC::Cmd Tags


IPC::Cmd Description

Finding and running system commands made easy IPC::Cmd is a Perl module that allows you to run commands platform independently, interactively if desired, but have them still work.The can_run function can tell you if a certain binary is installed and if so where, whereas the run function can actually execute any of the commands you give it and give you a clear return value, as well as adhere to your verbosity settings.SYNOPSIS use IPC::Cmd qw; 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 = ; ### 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; } ### check for features print "IPC::Open3 available: " . IPC::Cmd->can_use_ipc_open3; print "IPC::Run available: " . IPC::Cmd->can_use_ipc_run; print "Can capture buffer: " . IPC::Cmd->can_capture_buffer; ### don't have IPC::Cmd be verbose, ie don't print to stdout or ### stderr when running commands -- default is '0' $IPC::Cmd::VERBOSE = 0; Requirements: · Perl


IPC::Cmd Related Software