httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Hicks <mghi...@gmail.com>
Subject Apache::Test v1.25 error - Can't use string ("Test::Builder") as a HASH ref
Date Tue, 28 Jun 2005 18:35:17 GMT
Sanity check!  Using Apache::Test 1.25, Test::Simple 0.60, mod_perl 2.0,
Apache 2.0.54.  I have the following in t/response/TestHandler/01compile.pm

package TestHandler::01compile;

use strict;
use warnings FATAL => qw(all);
use Apache::Test qw(-withtestmore);
use Apache2::Const -compile => qw(OK);

sub handler {
  my $r = shift;
  plan $r, tests => 1;
  use_ok('My::ModPerlHandler');
  return Apache2::Const::OK;
}

1;

Can't use string ("Test::Builder") as a HASH ref while "strict refs"
in use at C:/Perl/lib/Test/Builder.pm line 179.

Looking at Test::Builder 0.30, one finds line 179 is the reset method.

sub reset {
    my ($self) = @_;

    # We leave this a global because it has to be localized and localizing
    # hash keys is just asking for pain.  Also, it was documented.
    $Level = 1;

    $self->{Test_Died}    = 0;      # line 179
    ...
     
Digging through Apache::Test, Test::Builder->reset is called only once,
in test_pm_refresh.

sub test_pm_refresh {
    if (@testmore) {
        Test::Builder->reset;
        ...

Now, this looks like a bug.  The T::B->reset method expects an object,
Apache::Test calls it as a class method.  I allow for the possibility that
I've completely misunderstood everything--or even just some things.

OTOH, if I avoid Test::More in A::T like so, the test succeeds.

use Apache::Test;
...
ok( sub { require My::ModPerlHandler }, 1 );

Not that that's a smart way to test it, just what came to mind.


-Matt

Mime
View raw message