On Thu, Jan 11, 2007 at 09:04:54AM -0800, Ovid wrote: > --- Nadim Khemir <[EMAIL PROTECTED]> wrote: > > > On Thursday 11 January 2007 15:30, Ovid wrote: > > > Quite often people will write code which tests to see if > > > $ENV{HARNESS_ACTIVE} is true. For example, this allows them to not > > > email support from their code while testing. This variable is set > > in > > > Test::Harness. However, this causes a problem when someone > > > accidentally does this: > > > > > >... > > > > > > Thoughts? > > > > Just one, Shouldn't the mailer "object" be mocked and the mail > > sending checked? > > Absolutely, but how do you know to mock it or really send the email > unless you know that you're being run by tests?
If I needed to know for sure whether I was running a test or not, I think I would make sure the test specified that somehow. Whether that was by directly setting an environment variable, or by using a package or by mocking a mailer or whatever, I think I would want to take the responsibility for that. Now I can see uses for knowing whether or not you are being run as part of an installation, or in some automated environment, and I can imagine someone would have a use for HARNESS_ACTIVE, though I can't see it myself, but I'm not sure this is it. And I'm afraid I didn't understand the paragraph about RUNNING_TESTS. Perhaps it's just me, but if you don't get any sensible comments on that you might want to try that paragraph again. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net