in reply to Using Sub::Override

Do you mean:

my $override=Sub::Override->new('Games::QuizTaker::IO::in'=>sub{ $Games::QuizTaker::line });

Replies are listed 'Best First'.
Re^2: Using Sub::Override
by TStanley (Canon) on Jun 19, 2007 at 02:16 UTC
    No. The out function is what actually prints the question to STDOUT. The in function is what reads the answer. $line is a variable inside the test function of Games::QuizTaker. For each question in the test, it loops through an array, putting each element into the $line variable and prints it out.

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

      I don't have enough information to help you then. Your code has baffled me; I have no idea why you would override out() to return a variable when you call it in void context, and I can't see what you would get from not mocking in(), which presumably prompts for input. I never prompt for input in any of my automated tests.