--- Michael G Schwern <[EMAIL PROTECTED]> wrote:

> It seems odd to me that people would be so concerned about the order
> of 
> execution, given the methods should be able to be executed in any
> order.  Any 
> idea why that was an issue?

It's an issue when you have multiple startup/setup/teardown/shutdown
methods.  If you have different names for them, you have to ensure that
subclasses have names with the correct spelling to ensure they get run
in the same order.

  sub connect_to_db : Tests(setup) {
      # hmm, will this get run before or after my
      # superclass setup?
  }

I've worked around that by naming the method after the appropriate
phase and calling SUPER as appropriate:

  sub setup : Tests(setup) {
      my $test = shift;
      $test->SUPER::setup;
      # rest of setup here
  }

This means I can't give these methods names which describe what they
do, but that's a small price to pay.  This requires that my base class,
if lacking appropriate methods, at least provide empty stubs to ensure
that I can use this without caring if it's implemented in a superclass
or note:

  package My::Test::Class;
  use base 'Test::Class';
  
  sub setup : Tests(setup) {}
  # and so on ...

Cheers,
Ovid

--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/

Reply via email to