http://www.perlmonks.org?node_id=693163

Ovid has asked for the wisdom of the Perl Monks concerning the following question:

You know, this has been a terrible birthday so far. Bugs, bugs, bugs. The latest one has me pulling my hair out, but I don't know why. Test::Deep and Test::Class don't play well together. Here's the smallest test case I can get.

package TestIt; use Test::Deep; use base 'Test::Class'; sub startup : Tests(startup) {} 1;

Trying to compile that results in:

Invalid CODE attribute: Tests(startup => 1) at TestIt.pm line 9 BEGIN failed--compilation aborted at TestIt.pm line 9.

I've gone nuts trying to debug this. Any thoughts?

Cheers,
Ovid

New address of my CGI Course.

Replies are listed 'Best First'.
Re: Why Does Test::Deep Kill Test::Class
by fergal (Chaplain) on Jun 20, 2008 at 14:24 UTC

    This was covered before (first hit on google for Test::Deep Test::Class BTW :).

    Not sure if Adrian did something to change Test::Class but the latest version of Test::Deep does some magic to make isa() just work. Have you tried the latest versions?

      Sheesh. I was checking RT bugs and Changelogs, but somehow didn't think about Google :)

      Updating Test::Deep solved this. Thanks. (Whew!)

      What a painfully long day this is.

      Cheers,
      Ovid

      New address of my CGI Course.

        This and some other stuff are the root of my hatred of default exports (and the lack of a nice way to use things without exports at all).

Re: Why Does Test::Deep Kill Test::Class
by kyle (Abbot) on Jun 20, 2008 at 14:20 UTC

    Don't use base? This does not complain:

    package TestIt; use Test::Deep; use Test::Class; BEGIN { @TestIt::ISA = ( 'Test::Class' ) } #use base 'Test::Class'; sub startup : Tests(startup) { }
Re: Why Does Test::Deep Kill Test::Class
by Anonymous Monk on Jun 20, 2008 at 14:22 UTC
    Because Test::Deep exports something that conflicts with the attribute handler, so
    use Test::Deep();