Belated response...
On 1 Jul 2007, at 23:19, Ovid wrote:
[snip]
I've just spent quite a bit of time debugging a problem where a
Test::Class setup method was misbehaving. My tests passed, but
mysql was spitting out errors directly to STDERR and quite a bit of
tracing led me to the following:
sub setup : Tests(setup) {
my $test = shift;
$test->SUPER::startup;
$test->_make_test_servers(
num_servers => 2,
username => 'Ovid',
);
}
As you can see, I called SUPER::startup instead of SUPER::setup.
[snip]
Not that it helps solve your problem - but I tend to use multiple
setup routines rather than inheritance to add extra set up code to a
class. I generally find it reads more cleanly since I can give my
methods more intention revealing names.
[snip]
It's trivial to write code in my stubs which check the caller and
issue a warning and maybe I can just walk back through the call
stack to issue a warning if I'm ever called by an inappropriately
named method, but that seems a bit hackish. Is there some better
way to solve this problem?
[snip]
Nothing obvious springs to mind - seems like a generic perl problem/
feature.
Then again I'm not exactly feeling 100% at the moment so I could be
missing something obvious :-)
You could, of course, use something like chromatic's SUPER and write
it as:
sub setup : Tests(setup) {
my $test = shift;
super;
$test->_make_test_servers(
num_servers => 2,
username => 'Ovid',
);
}
?
Adrian
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/