$VERSION = 0.02;
@EXPORT = qw(which_perl perl_lib makefile_name makefile_backup
- make make_run make_macro calibrate_mtime
+ make make_run run make_macro calibrate_mtime
);
my $Is_VMS = $^O eq 'VMS';
my $mtime = calibrate_mtime;
+ my $out = run($cmd);
+
=head1 DESCRIPTION
A consolidation of little utility functions used through out the
return $mtime;
}
+=item B<run>
+
+ my $out = run($command);
+ my @out = run($command);
+
+Runs the given $command as an external program returning at least STDOUT
+as $out. If possible it will return STDOUT and STDERR combined as you
+would expect to see on a screen.
+
+=cut
+
+sub run {
+ my $cmd = shift;
+
+ require ExtUtils::MM;
+
+ # Unix can handle 2>&1 and OS/2 from 5.005_54 up.
+ # This makes our failure diagnostics nicer to read.
+ if( MM->os_flavor_is('Unix') or
+ ($] > 5.00554 and MM->os_flavor_is('OS/2'))
+ ) {
+ return `$cmd 2>&1`;
+ }
+ else {
+ return `$cmd`;
+ }
+}
+
=back
=head1 AUTHOR