Capture STDOUT and STDERR from Perl code, subprocesses or XS
https://metacpan.org/release/IO-CaptureOutput