I'm really not sure of the best way to handle this, so I thought I'd toss this 
out to some of you folks.

I recently found out that one of my test programs accidentally sent a bunch of 
error email to our support staff.  There's often an environment variable named 
'HARNESS_ACTIVE' if tests are being run, but I think it would be helpful to 
have something a bit more reliable (that variable's not set if I just run the 
tests with 'perl testname.t').  For the time being, I have the following check 
in my code:

  unless ( defined &Test::More::ok ) { send_email(@args) }

However, I don't feel entirely comfortable with that (and %INC check would be 
just as bad).  If some errant code were to load Test::More for some silly 
reason, I'm not going to send error email.

It would be nice if I could just write 'use My::Test::More' in my test scripts 
and have that provide what I need, but I'm not sure if trying to re-export all 
of the test functions from Test::More (kind of like subclassing which isn't a 
class) is a bright idea, but it's the cleanest I can think of.  Am I missing 
something really obvious here?

Cheers,
Ovid
 
-- 
Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/



Reply via email to