Best practice for unit tests that rely on internet access?
David Cantrell
david at cantrell.org.uk
Tue May 3 17:13:42 BST 2011
On Tue, May 03, 2011 at 04:31:02PM +0100, Mark Fowler wrote:
> On Tue, May 3, 2011 at 2:09 PM, David Cantrell <david at cantrell.org.uk> wrote:
> > Interactivity is fine, provided it has sensible defaults.
> It's worth knowing about the ExtUtils::MakeMaker::prompt function
> which can be used to ask simple interactive questions. In particular
> this will allow you to specify a default (e.g. don't connect to the
> network) and have this automatically used if STDIN isn't connected to
> anything or the PERL_MM_USE_DEFAULT env var is set to true.
That also Does The Right Thing with buffering. Under some circumstances,
home-brew prompting using print() and <STDIN> doesn't display the prompt
until after the user has answered the question and hit enter. Generally
when you're doing stuff like tee(1)ing so that you have a log of the
install.
--
David Cantrell | Reality Engineer, Ministry of Information
For every vengeance, there is an equal and opposite revengeance.
-- Cartoon Law X
More information about the london.pm
mailing list