in reply to Interactive Test

You might want to look at Term::ReadLine.

But, if having to press enter is acceptable, here's one method without using that module:

print "Do you want to run live tests (y/n)? "; my $answer = <STDIN>; # beware of trailing newlines if ($answer =~ /^n/i) { $foo = 0 } elsif ($answer =~ /^y/i { $foo = 1 } else { $foo = $default_foo } # default

Or, you could repeat question with a goto LABEL or by wrapping it in a loop and only breaking out when an answer is acceptable.

Replies are listed 'Best First'.
Re^2: Interactive Test
by ait (Hermit) on Sep 17, 2010 at 21:28 UTC

    Thanks but it's a bit more complex than that. Tests run generally under prove or similar so your test script doesn't have easy access to the outside world. Nontheless, I have seen many times interactive tests, just haven't bothered to save the code after install to find out how, and I don't remember any specific module that does it, as to download and figure it out.