File: capture.pl

package info (click to toggle)
libio-captureoutput-perl 1.1105-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 244 kB
  • sloc: perl: 508; makefile: 7
file content (15 lines) | stat: -rwxr-xr-x 273 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use strict;
use warnings;
use IO::CaptureOutput qw/capture/;

my ($stdout, $stderr);

capture sub {
    print "This prints to STDOUT\n";
    print STDERR "This prints to STDERR\n";
} => \$stdout, \$stderr;

print "STDOUT was:\n$stdout\n";

print "STDERR was:\n$stderr\n";