mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-18 03:46:03 +00:00
ad4f267b7a
search.cpan.org is shutting down. It will redirect to metacpan.org after June 25, 2018. With hat: perl
21 lines
578 B
Plaintext
21 lines
578 B
Plaintext
Normally if a part of a pipe fails, depending on the location, it won't
|
|
be detected. This breaks down a command involving pipes and runs each
|
|
command separately.
|
|
|
|
It uses open3 to run each chunk of the pipe.
|
|
|
|
use IO::MultiPipe;
|
|
|
|
my $pipes = IO::MultiPipe->new();
|
|
|
|
#This sets the pipe that will be run.
|
|
$pipes->set('sed s/-// | sed s/123/abc/ | sed s/ABC/abc/');
|
|
if ($pipes->{error}){
|
|
print "Error!\n";
|
|
}
|
|
|
|
#'123-ABCxyz' through the command set above.
|
|
my $returned=$pipes->run('123-ABCxyz');
|
|
|
|
WWW: https://metacpan.org/release/IO-MultiPipe
|