|
NAMEIPC::Open3::Simple - A simple alternative to IPC::Open3VERSION$Id: Simple.pm,v 1.7 2006/07/20 13:30:02 erwan Exp $SYNOPSISTo run 'ls' in a few directories and put the returned lines in a list:my @files; my $ipc = IPC::Open3::Simple->new(out => sub { push @files, $_[0]; }) $ipc->run('ls /etc/'); $ipc->run('ls /home/erwan/'); To run a 'cvs up' and do different stuff with what cvs writes to stdout and stderr: IPC::Open3::Simple->new(out => \&parse_cvs_stdout, err => \&parse_cvs_stderr)->run('cvs up'); DESCRIPTIONIPC::Open3::Simple aims at making it very easy to start a shell command, eventually feed its stdin with some data, then retrieve its stdout and stderr separately.When you want to run a shell command and parse its stdout/stderr or feed its stdin, you often end up using IPC::Run, IPC::Cmd or IPC::Open3 with your own parsing code, and end up writing more code than you intended. IPC::Open3::Simple is about removing this overhead and making IPC::Open3 easier to use. IPC::Open3::Simple calls IPC::Open3 and redirects stdin, stdout and stderr to some function references passed in argument to the constructor. It does a select on the input/output filehandles returned by IPC::Open3 and dispatches their content to and from those functions. INTERFACE
DIAGNOSTICS
BUGS AND LIMITATIONSNo bugs so far.Limitation: IPC::Open3::Simple is not designed for interactive interprocess communication. Do not use it to steer the process opened by open3 via stdin/stdout/stderr, use fork and pipes or some appropriate IPC module for that. IPC::Open3::Simple's scope is to easily run a command, eventually with some stdin input, and get its stdout and stderr along the way, not to interactively communicate with the command. SEE ALSOSee IPC::Open3, IPC::Run, IPC::Cmd.COPYRIGHT AND LICENSECopyright (C) by Erwan Lemonnier "<erwan@cpan.org>"This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
Visit the GSP FreeBSD Man Page Interface. |