-sub run_perl {
- my $code = shift;
-
- my ($SystemRoot, $PATH) = @ENV{qw<SystemRoot PATH>};
- local %ENV;
- $ENV{SystemRoot} = $SystemRoot if $^O eq 'MSWin32' and defined $SystemRoot;
- $ENV{PATH} = $PATH if $^O eq 'cygwin' and defined $PATH;
-
- system { $^X } $^X, '-T', map("-I$_", @INC), '-e', $code;
-}
-
-my $has_capture_tiny = do {
- local $@;
- eval {
- require Capture::Tiny;
- Capture::Tiny->VERSION('0.08');
- }
-};
-if ($has_capture_tiny) {
- local $@;
- my $output = eval {
- Capture::Tiny::capture_merged(sub { run_perl <<' CODE' });
-print STDOUT "pants\n";
-print STDERR "trousers\n";
- CODE
- };
- unless (defined $output and $output =~ /pants/ and $output =~ /trousers/) {
- $has_capture_tiny = 0;
- }
-}
-if ($has_capture_tiny) {
- defined and diag "Using Capture::Tiny $_" for $Capture::Tiny::VERSION;
-}
-
-SKIP:
-{