You are looking at a very old, but free version of the course. If you are interesed the most recent version, check it out on the Perl Maven site.

7.20. Capturing both STDOUT and STDERR manually

Example 7-10. examples/io/capture.pl

#!/usr/bin/perl -w
use strict;

use Test::More tests => 2;


my $app = "./examples/io/application.pl";

my @in = ('10', '21', 'hello', '3x');
my $in = join "\n", @in;

my @expected_out = ('20', '42');
my @expected_err = (
		"The input 'hello' contains no numeric values", 
		"The input '3x' contains no numeric values",
	);

{
	open my $fh, ">", "/tmp/in" or die $!;
	print $fh $in;
}

system "$app < /tmp/in > /tmp/out 2> /tmp/err";

{
	open my $fh, "<", "/tmp/out" or die $!;
	my @out = <$fh>;
	chomp @out;
	is_deeply(\@out, \@expected_out, "Output");
}	
{
	open my $fh, "<", "/tmp/err" or die $!;
	my @err = <$fh>;
	chomp @err;
	is_deeply(\@err, \@expected_err, "Error");
}	

If you are interested in on-site trainings by the author, please contact me directly.