#!/usr/bin/perl use strict; use warnings; use vars qw($expected $expected_error); use Test::More 'no_plan'; use Test::LongString; use IPC::Open3; my $command = q|./my-script.pl -e PARAM1 -a PARAM2 -s PARAM3|; my $input; my $pid = open3( $input, \*OUT, \*ERROR, $command ); close $input; my $output = do { local $/; }; my $error = do { local $/; }; #print "=" x 73, "\n$output\n", "=" x 73, "\n"; is_string( $output, $expected, "output is what I wanted" ); is_string( $error, $expected_error, "warning is right" ); BEGIN { $expected_error = <<"HERE"; Hier steht das was ich in diesem Fall als Fehlermeldung erwarte HERE $expected = <<"HERE"; Hier steht alles was auf STDOUT landen soll HERE }