IPC::Cmd 0.78
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[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;
}
### 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;
Product's homepage
Requirements:
Ссылка: http://search.c..thors/id/B/BI/BINGOS/IPC-Cmd-0.78.tar.gz
Новые:
|
Рейтинг за сегодня::
|
Похожие:
|