package ABCUtilities; #!/usr/bin/perl use warnings; use strict; use IPC::Open3; sub execute { my $cmd = shift; my $pid = open3(\*WRITER, \*READER, \*ERROR, $cmd); my ($err_msg, $out_msg) = ('', ''); while( my $output = ) { $out_msg .= $output; # . "
"; } while( my $errout = ) { $err_msg .= $errout; # . "
"; } waitpid( $pid, 0 ) or die "$!\n"; my $exit_code = $? >> 8; return ($exit_code, $err_msg, $out_msg); } 1;