my $has_capture_tiny = do {
local $@;
- eval 'use Capture::Tiny 0.08 (); 1'
+ eval {
+ require Capture::Tiny;
+ Capture::Tiny->VERSION('0.08');
+ }
};
if ($has_capture_tiny) {
- my $output = Capture::Tiny::capture_merged(sub { run_perl <<' CODE' });
+ local $@;
+ my $output = eval {
+ Capture::Tiny::capture_merged(sub { run_perl <<' CODE' });
print STDOUT "pants\n";
print STDERR "trousers\n";
- CODE
+ CODE
+ };
unless (defined $output and $output =~ /pants/ and $output =~ /trousers/) {
$has_capture_tiny = 0;
}