On Wednesday, July 30, 2003, at 05:50 am, Struan Donald wrote:

[snip]
More specifically is there some way I can ask for the information
and if I don't get a response in x seconds assume either defaults or
SKIP the test?
[snip]

You /could/ do something like this to get your config in the Makefile.PL...
--
use Term::ReadKey;


sub timed_read_string {
        my $timeout = shift;
        my $string;
        while ( defined (my $key = ReadKey($timeout)) ) {
                return $string if $key eq "\n";
                $string .= $key;
        }
        return;
};

my $string = timed_read_string(5);
print "you typed ", defined($string) ? $string : "nothing for 5s", "\n";
--
... but, if it were me, I wouldn't. Is the time saved by having things run unattended worth the cost of a possible failed installation? If somebody writes tests they should be run (IMHO of course :-).


[snip]
And, yes, I'm aware I should probably try and avoid interactive tests
altogether but in this case there's no other way to get the
information I need.
[snip]

Are you *really* sure about that? I've found that mock objects and judicious use of standalone W3 and DB servers (e.g. SQLite) have removed all need for interactive tests - unless there really is no alternative (e.g. the user has to press a button to test the button pressing).

Adrian




Reply via email to