Hi all,

On Thursday, October 10, 2002, at 05:04  pm, Tony Bowden wrote:
[snip]
>       use Test::Class;
>       use UNIVERSAL::require;
>
>   my @tests = qw( Example::Test Another::Test );
>   foreach my $class (@tests) {
>     $class->require or die "Can't require $class";
>   }
>   Test::Class->runtests(@tests);
>
> However this keeps dying with "cannot test anonymous subs". A
> cursory delve into the innards of Test::Class implies that perhaps
> Attribute::Handlers is getting confused somewhere. But I'm not sure
> what's going on here really ...
[snip]

Think I've figured it out.

If you stick your loop inside a BEGIN {} block I think you'll find that it 
works as you expect.

The attribute handler in Test::Class is set to run as a CHECK block (the 
default provided by Attribute::Handlers). Since you don't require the 
module until runtime the handler gets confused.

I'm running A::H 0.78 - and in my case it just skips running the 
handler... so no test methods get defined and nothing gets run.

I am guessing that you're running an earlier version of A::H and that's 
why it's passing ANON as the symbol to the Test::Class handler, hence the 
confusing error message.

Hopefully that makes some vague sort of sense!

Now I need to figure out if:
        (a) this is a bug or a lack of documentation on my part
        (b) if/how it can be fixed :-)

Hope this helps.

Cheers,

Adrian

Reply via email to