Class-Tiny

 view release on metacpan or  search on metacpan

t/lib/TestUtils.pm  view on Meta::CPAN

our @ISA = qw/Exporter/;
our @EXPORT = qw(
    exception
);

# If we have Test::FailWarnings, use it
BEGIN {
    eval { require Test::FailWarnings; 1 } and do { Test::FailWarnings->import };
}

sub exception(&) {
    my $code = shift;
    my $success = eval { $code->(); 1 };
    my $err = $@;
    return '' if $success;
    croak "Execution died, but the error was lost" unless $@;
    return $@;
}

1;



( run in 0.803 second using v1.01-cache-2.11-cpan-49f99fa48dc )