From 39b09a1b697b89ae14eb0e590e2444bb112d681a Mon Sep 17 00:00:00 2001 From: Chris 'BinGOs' Williams Date: Tue, 23 Nov 2010 12:21:02 +0000 Subject: [PATCH] Update IPC-Cmd to CPAN version 0.66 [DELTA] Changes for 0.66 Tue Nov 23 12:10:24 GMT 2010 ================================================= * Apply documentation patch from Dan Dascalescu [RT # 63250] * Apply another documentation patch from Dan Dascalescu [RT #63251] * Fix an issue with _split_like_shell_win32() raised by tunakermit [RT #62961] --- Porting/Maintainers.pl | 2 +- cpan/IPC-Cmd/lib/IPC/Cmd.pm | 137 ++++++++++++++++++++++---------------------- pod/perldelta.pod | 7 +++ 3 files changed, 76 insertions(+), 70 deletions(-) diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index d3c0842..fa6a8bf 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -761,7 +761,7 @@ use File::Glob qw(:case); 'IPC::Cmd' => { 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/IPC-Cmd-0.64.tar.gz', + 'DISTRIBUTION' => 'BINGOS/IPC-Cmd-0.66.tar.gz', 'FILES' => q[cpan/IPC-Cmd], 'UPSTREAM' => 'cpan', }, diff --git a/cpan/IPC-Cmd/lib/IPC/Cmd.pm b/cpan/IPC-Cmd/lib/IPC/Cmd.pm index 9cd9e97..3ac438e 100644 --- a/cpan/IPC-Cmd/lib/IPC/Cmd.pm +++ b/cpan/IPC-Cmd/lib/IPC/Cmd.pm @@ -17,7 +17,7 @@ BEGIN { $INSTANCES ]; - $VERSION = '0.64'; + $VERSION = '0.66'; $VERBOSE = 0; $DEBUG = 0; $WARN = 1; @@ -76,7 +76,7 @@ IPC::Cmd - finding and running system commands made easy ### in list context ### - my( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = + my( $success, $error_message, $full_buf, $stdout_buf, $stderr_buf ) = run( command => $cmd, verbose => 0 ); if( $success ) { @@ -96,8 +96,8 @@ IPC::Cmd - finding and running system commands made easy =head1 DESCRIPTION -IPC::Cmd allows you to run commands, interactively if desired, -platform independent but have them still work. +IPC::Cmd allows you to run commands platform independently, +interactively if desired, but have them still work. The C function can tell you if a certain binary is installed and if so where, whereas the C function can actually execute any @@ -109,8 +109,8 @@ as adhere to your verbosity settings. =head2 $ipc_run_version = IPC::Cmd->can_use_ipc_run( [VERBOSE] ) Utility function that tells you if C is available. -If the verbose flag is passed, it will print diagnostic messages -if C can not be found or loaded. +If the C flag is passed, it will print diagnostic messages +if L can not be found or loaded. =cut @@ -119,7 +119,7 @@ sub can_use_ipc_run { my $self = shift; my $verbose = shift || 0; - ### ipc::run doesn't run on win98 + ### IPC::Run doesn't run on win98 return if IS_WIN98; ### if we dont have ipc::run, we obviously can't use it. @@ -145,11 +145,10 @@ sub can_use_ipc_open3 { my $self = shift; my $verbose = shift || 0; - ### ipc::open3 is not working on VMS becasue of a lack of fork. - ### XXX todo, win32 also does not have fork, so need to do more research. + ### IPC::Open3 is not working on VMS because of a lack of fork. return if IS_VMS; - ### ipc::open3 works on every non-VMS platform platform, but it can't + ### IPC::Open3 works on every non-VMS platform platform, but it can't ### capture buffers on win32 :( return unless can_load( modules => { map {$_ => '0.0'} qw|IPC::Open3 IO::Select Symbol| }, @@ -183,7 +182,7 @@ providing C on the current platform. =head2 $path = can_run( PROGRAM ); -C takes but a single argument: the name of a binary you wish +C takes only one argument: the name of a binary you wish to locate. C works much like the unix binary C or the bash command C, which scans through your path, looking for the requested binary. @@ -194,9 +193,9 @@ will also work on, for example, Win32. If called in a scalar context it will return the full path to the binary you asked for if it was found, or C if it was not. -If called in a list context and the global variable C<$INSTANCES> is a true value -it will return a list of the full paths to instances -of the binary where found in C or an empty list if it was not found. +If called in a list context and the global variable C<$INSTANCES> is a true +value, it will return a list of the full paths to instances +of the binary where found in C, or an empty list if it was not found. =cut @@ -246,15 +245,15 @@ This is the command to execute. It may be either a string or an array reference. This is a required argument. -See L for remarks on how commands are parsed and their +See L<"Caveats"> for remarks on how commands are parsed and their limitations. =item verbose This controls whether all output of a command should also be printed to STDOUT/STDERR or should only be trapped in buffers (NOTE: buffers -require C to be installed or your system able to work with -C). +require L to be installed, or your system able to work with +L). It will default to the global setting of C<$IPC::Cmd::VERBOSE>, which by default is 0. @@ -269,14 +268,14 @@ If you require this distinction, run the C command in list context and inspect the individual buffers. Of course, this requires that the underlying call supports buffers. See -the note on buffers right above. +the note on buffers above. =item timeout Sets the maximum time the command is allowed to run before aborting, using the built-in C call. If the timeout is triggered, the C in the return value will be set to an object of the -C class. See the C section below for +C class. See the L<"error message"> section below for details. Defaults to C<0>, meaning no timeout is set. @@ -296,7 +295,7 @@ not. =item error message -If the first element of the return value (success) was 0, then some +If the first element of the return value (C) was 0, then some error occurred. This second element is the error message the command you requested exited with, if available. This is generally a pretty printed value of C<$?> or C<$@>. See C for details on @@ -306,31 +305,26 @@ the string C, the timeout class. =item full_buffer -This is an arrayreference containing all the output the command +This is an array reference containing all the output the command generated. -Note that buffers are only available if you have C installed, -or if your system is able to work with C -- See below). -This element will be C if this is not the case. +Note that buffers are only available if you have L installed, +or if your system is able to work with L -- see below). +Otherwise, this element will be C. =item out_buffer -This is an arrayreference containing all the output sent to STDOUT the -command generated. -Note that buffers are only available if you have C installed, -or if your system is able to work with C -- See below). -This element will be C if this is not the case. +This is an array reference containing all the output sent to STDOUT the +command generated. The notes from L<"full_buffer"> apply. =item error_buffer This is an arrayreference containing all the output sent to STDERR the -command generated. -Note that buffers are only available if you have C installed, -or if your system is able to work with C -- See below). -This element will be C if this is not the case. +command generated. The notes from L<"full_buffer"> apply. + =back -See the C Section below to see how C decides +See the L<"HOW IT WORKS"> section below to see how C decides what modules or function calls to use when issuing a command. =cut @@ -596,8 +590,8 @@ sub open3_run { C is used to execute some program or a coderef, optionally feed it with some input, get its return code and output (both stdout and stderr into separate buffers). -In addition it allows to terminate the program -which take too long to finish. +In addition, it allows to terminate the program +if it takes too long to finish. The important and distinguishing feature of run_forked is execution timeout which at first seems to be @@ -625,22 +619,23 @@ Invocation requires the command to be executed or a coderef and optionally a has =item C -Specify in seconds how long the command may run for before it is killed with with SIG_KILL (9) +Specify in seconds how long to run the command before it is killed with with SIG_KILL (9), which effectively terminates it and all of its children (direct or indirect). =item C -Specify some text that will be passed into C of the executed program. +Specify some text that will be passed into the C of the executed program. =item C -You may provide a coderef of a subroutine that will be called a portion of data is received on -stdout from the executing program. +Coderef of a subroutine to call when a portion of data is received on +STDOUT from the executing program. =item C -You may provide a coderef of a subroutine that will be called a portion of data is received on -stderr from the executing program. +Coderef of a subroutine to call when a portion of data is received on +STDERR from the executing program. + =item C @@ -669,18 +664,18 @@ The number of seconds the program ran for before being terminated, or 0 if no ti =item C -Holds the standard output of the executed command -(or empty string if there were no stdout output or if discard_output was used; it's always defined!) +Holds the standard output of the executed command (or empty string if +there was no STDOUT output or if C was used; it's always defined!) =item C -Holds the standard error of the executed command -(or empty string if there were no stderr output or if discard_output was used; it's always defined!) +Holds the standard error of the executed command (or empty string if +there was no STDERR output or if C was used; it's always defined!) =item C Holds the standard output and error of the executed command merged into one stream -(or empty string if there were no output at all or if discard_output was used; it's always defined!) +(or empty string if there was no output at all or if C was used; it's always defined!) =item C @@ -1256,7 +1251,7 @@ sub _open3_run { } } -### text::parsewords::shellwordss() uses unix semantics. that will break +### Text::ParseWords::shellwords() uses unix semantics. that will break ### on win32 { my $parse_sub = IS_WIN32 ? __PACKAGE__->can('_split_like_shell_win32') @@ -1504,7 +1499,7 @@ sub _split_like_shell_win32 { } elsif ( $ch eq '"' ) { $quote_mode = !$quote_mode; } elsif ( $ch eq ' ' && !$quote_mode ) { - push( @argv, $arg ) if $arg; + push( @argv, $arg ) if defined( $arg ) && length( $arg ); $arg = ''; ++$i while substr( $_, $i + 1, 1 ) eq ' '; } else { @@ -1657,28 +1652,28 @@ C will try to execute your command using the following logic: =item * If you have C installed, and the variable C<$IPC::Cmd::USE_IPC_RUN> -is set to true (See the C Section) use that to execute +is set to true (See the L<"Global Variables"> section) use that to execute the command. You will have the full output available in buffers, interactive commands are sure to work and you are guaranteed to have your verbosity settings honored cleanly. =item * Otherwise, if the variable C<$IPC::Cmd::USE_IPC_OPEN3> is set to true -(See the C Section), try to execute the command using -C. Buffers will be available on all platforms except C, +(See the L<"Global Variables"> section), try to execute the command using +L. Buffers will be available on all platforms except C, interactive commands will still execute cleanly, and also your verbosity settings will be adhered to nicely; =item * -Otherwise, if you have the verbose argument set to true, we fall back -to a simple system() call. We cannot capture any buffers, but +Otherwise, if you have the C argument set to true, we fall back +to a simple C call. We cannot capture any buffers, but interactive commands will still work. =item * Otherwise we will try and temporarily redirect STDERR and STDOUT, do a -system() call with your command and then re-open STDERR and STDOUT. +C call with your command and then re-open STDERR and STDOUT. This is the method of last resort and will still allow you to execute your commands cleanly. However, no buffers will be available. @@ -1692,7 +1687,7 @@ global variables: =head2 $IPC::Cmd::VERBOSE This controls whether IPC::Cmd will print any output from the -commands to the screen or not. The default is 0; +commands to the screen or not. The default is 0. =head2 $IPC::Cmd::USE_IPC_RUN @@ -1706,7 +1701,7 @@ when available and suitable. Defaults to true. =head2 $IPC::Cmd::WARN -This variable controls whether run time warnings should be issued, like +This variable controls whether run-time warnings should be issued, like the failure to load an C module you explicitly requested. Defaults to true. Turn this off at your own risk. @@ -1727,16 +1722,16 @@ Defaults to false, set to true to enable the described behaviour. When using C or C, if you provide a string as the C argument, it is assumed to be appropriately escaped. You can use the C constant to use as a portable quote character (see above). -However, if you provide and C, special rules apply: +However, if you provide an array reference, special rules apply: -If your command contains C (< > | &), it will +If your command contains B (< > | &), it will be internally stringified before executing the command, to avoid that these special characters are escaped and passed as arguments instead of retaining their special meaning. However, if the command contained arguments that contained whitespace, stringifying the command would loose the significance of the whitespace. -Therefor, C will quote any arguments containing whitespace in your +Therefore, C will quote any arguments containing whitespace in your command if the command is passed as an arrayref and contains special characters. =item Whitespace and IPC::Run @@ -1748,7 +1743,7 @@ break if you have files or commands with whitespace in them. If you do not wish this to happen, you should provide an array reference, where all parts of your command are already separated out. -Note however, if there's extra or spurious whitespace in these parts, +Note however, if there are extra or spurious whitespaces in these parts, the parser or underlying code may not interpret it correctly, and cause an error. @@ -1775,36 +1770,39 @@ Since this will lead to issues as described above. =item IO Redirect Currently it is too complicated to parse your command for IO -Redirections. For capturing STDOUT or STDERR there is a work around +redirections. For capturing STDOUT or STDERR there is a work around however, since you can just inspect your buffers for the contents. =item Interleaving STDOUT/STDERR Neither IPC::Run nor IPC::Open3 can interleave STDOUT and STDERR. For short -bursts of output from a program, ie this sample: +bursts of output from a program, e.g. this sample, for ( 1..4 ) { $_ % 2 ? print STDOUT $_ : print STDERR $_; } IPC::[Run|Open3] will first read all of STDOUT, then all of STDERR, meaning -the output looks like 1 line on each, namely '13' on STDOUT and '24' on STDERR. +the output looks like '13' on STDOUT and '24' on STDERR, instead of -It should have been 1, 2, 3, 4. + 1 + 2 + 3 + 4 This has been recorded in L as bug #37532: Unable to interleave -STDOUT and STDERR +STDOUT and STDERR. =back =head1 See Also -C, C +L, L =head1 ACKNOWLEDGEMENTS Thanks to James Mastros and Martijn van der Streek for their -help in getting IPC::Open3 to behave nicely. +help in getting L to behave nicely. Thanks to Petya Kohts for the C code. @@ -1814,7 +1812,8 @@ Please report bugs or other issues to Ebug-ipc-cmd@rt.cpan.orgE. =head1 AUTHOR -This module by Jos Boumans Ekane@cpan.orgE. +Original author: Jos Boumans Ekane@cpan.orgE. +Current maintainer: Chris Williams Ebingos@cpan.orgE. =head1 COPYRIGHT diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 544a813..580ea93 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -96,6 +96,13 @@ XXX =item * +C has been upgraded from 0.64 to 0.66 + +Resolves an issue with splitting Win32 command lines +and documentation enhancements. + +=item * + XXX =back -- 2.7.4