File: Capture.pm

package info (click to toggle)
libtest-differences-perl 0.72-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 192 kB
  • sloc: perl: 498; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 373 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package #
    Test::Differences::TestUtils::Capture;

use strict;
use warnings;
use Exporter qw(import);

our @EXPORT = qw(capture_error);

use Capture::Tiny qw(capture);

sub capture_error(&) {
    my $sub = shift;
    my($stdout, $stderr) = capture { $sub->() };
    $stderr =~ s/^\s+//; # see https://github.com/Ovid/Test-Differences/issues/15
    return $stderr;
}

1;