File: rt-58208.pl

package info (click to toggle)
libcapture-tiny-perl 0.50-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 360 kB
  • sloc: perl: 852; makefile: 2
file content (11 lines) | stat: -rw-r--r-- 366 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
use Capture::Tiny qw[ capture ];

my ( $out, $err ) =
 eval { capture { print STDERR "hello\n"; print STDOUT "there\n"; die("foo\n" ) } };

print STDERR "STDERR:\nout=$out\nerr=$err\n\$@=$@";
print STDOUT "STDOUT:\nout=$out\nerr=$err\n\$@=$@";

open FILE, '>ttt.log' or die( "error opening logfile\n" );
print FILE "FILE:\nout=$out\nerr=$err\n\$@=$@\n";
close FILE;