http://www.perlmonks.org?node_id=621886

TStanley has asked for the wisdom of the Perl Monks concerning the following question:

After reading through the documentation for Test::MockObject, I decided that it was a slight case of overkill for what I wanted to do. After some research, I found Ovid's Sub::Override module, and decided to use that.
use Test::More tests=>1; use Games::QuizTaker; use Sub::Override; my $expected='Who is the creator of Perl?'; my $override=Sub::Override->new('Games::QuizTaker::IO::out'=>sub{ $Gam +es::QuizTaker::line }); my $GQ=Games::QuizTaker->new(filename=>'t/testqa'); $GQ->load; $GQ->generate; my $OUT=$GQ->test; like($OUT,qr/$expected/);

However, when I run 'make test', I get the following output:
tstanley@perlmonk ~/modules/Games-QuizTaker $ make test PERL_DL_NONLAZY=1 /usr/bin/perl5.8.8 "-MExtUtils::Command::MM" "-e" "t +est_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01load..........ok + t/02generate......ok + t/03test.......... Use of uninitialized value in pattern match (m//) at t/03test.t line 1 +6, <STDIN> line 1. # Failed test at t/03test.t line 16. # undef # doesn't match '(?-xism:Who is the creator of Perl?)' # Looks like you failed 1 test of 1. t/03test..........dubious + Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 1 Failed 1/1 tests, 0.00% okay t/04exceptions....ok + t/05pod...........ok + Failed Test Stat Wstat Total Fail List of Failed ---------------------------------------------------------------------- +--------- t/03test.t 1 256 1 1 1 Failed 1/5 test scripts. 1/15 subtests failed. Files=5, Tests=15, 2 wallclock secs ( 0.46 cusr + 0.04 csys = 0.50 +CPU) Failed 1/5 test programs. 1/15 subtests failed. make: *** [test_dynamic] Error 255
It also hangs on the test file until I press the 'Enter' key
Here is the code for the test function that I am trying to test:
sub test{ my $self=shift; my $Answer_Sep=$self->get_AnswerDelimiter; my $Max=$self->get_MaxQuestions; my ($answer,$key,$line,$question_answer); my $question_number=1; my $number_correct=0; my $asep=qq"\\$Answer_Sep"; system(($^O eq "MSWin32"?'cls':'clear')); print"\n"; while($question_number<=$Max){ $key=shift @Randoms; print"Question Number $question_number\n"; foreach $line(@{$$questions{$key}}){ Games::QuizTaker::IO::out(wrap("","","$line\n")); } print"Your Answer: "; $answer=Games::QuizTaker::IO::in; chomp($answer); $answer=uc($answer);
Any pointers/hints as to what the simple thing that I am obviously overlooking would be greatly appreciated

TStanley
--------
People sleep peaceably in their beds at night only because rough men stand ready to do violence on their behalf. -- George Orwell