You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Matt Hicks <mg...@gmail.com> on 2005/06/28 20:35:17 UTC

Apache::Test v1.25 error - Can't use string ("Test::Builder") as a HASH ref

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

Re: Apache::Test v1.25 error - Can't use string ("Test::Builder") as a HASH ref

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Geoffrey Young wrote:
>>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.
> 
> 
> well, it's not exactly a bug - it looks like Test::Builder changed
> reset() from a class method to an object method since that code was written.
> 
> I guess I'll need to fix that :)

fixed in svn.  if you have a moment to test, that would be great.

--Geoff

Re: Apache::Test v1.25 error - Can't use string ("Test::Builder") as a HASH ref

Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
> Stas Bekman wrote:
> 
>>Geoffrey Young wrote:
>>
>>
>>>>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.
>>>
>>>
>>>well, it's not exactly a bug - it looks like Test::Builder changed
>>>reset() from a class method to an object method since that code was written.
>>>
>>>I guess I'll need to fix that :)
>>
>>
>>Or may be just move the branch that bundles T-M in into the trunk? This
>>problem has been fixed in that branch if I remember correctly.
> 
> 
> well, I want to run that branch through a battery of tests before we go
> and merge it into trunk - I, for one, have quite a bit of testing code
> that relies on proper Test::More support, so if that all ends up working
> we're probably good to go.
> 
> has this issue been resolved yet?
> 
> http://marc.theaimsgroup.com/?l=apache-modperl-test-dev&m=111512322421210&w=2

Sorry, I haven't tried it when you've reported it, but it seems to work fine:

t/TEST  -bugreport -verbose=0 t/more/02testmore.t
setting ulimit to allow core files
ulimit -c unlimited; /home/stas/perl/5.8.7-ithread/bin/perl5.8.7 
/home/stas/apache.org/Apache-Test-unstable/t/TEST -bugreport -verbose=0 
't/more/02testmore.t'
the default base port is used, using base port 8569 instead
/home/stas/httpd/prefork/bin/httpd  -d 
/home/stas/apache.org/Apache-Test-unstable/t -f 
/home/stas/apache.org/Apache-Test-unstable/t/conf/httpd.conf -D APACHE2 -D 
PERL_USEITHREADS
using Apache/2.0.55-dev (prefork MPM)
waiting 60 seconds for server to start: ok (waited 1 secs)
server lapin.stason.org:8569 started
t/more/02testmore....[   info] the default base port is used, using base 
port 8589 instead
request has failed (the response code was: 500)
see t/logs/error_log for more details
# Looks like your test died before it could output anything.
t/more/02testmore....dubious
         Test returned status 255 (wstat 65280, 0xff00)
FAILED--1 test script could be run, alas--no output ever seen
server lapin.stason.org:8569 shutdown
error running tests (please examine t/logs/error_log)
+-----------------------------------------------------+
| To report problems please refer to the SUPPORT file |
+-----------------------------------------------------+
make: *** [run_tests] Error 1
2

So it's all good right?

BTW, I've just synced the branch with the trunk.

BTW, once svn.merge was run in the future, you just run it again, since it 
already sets the mergepoint at the end of its run. Joe Orton rocks!


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: Apache::Test v1.25 error - Can't use string ("Test::Builder") as a HASH ref

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Stas Bekman wrote:
> Geoffrey Young wrote:
> 
>>>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.
>>
>>
>>well, it's not exactly a bug - it looks like Test::Builder changed
>>reset() from a class method to an object method since that code was written.
>>
>>I guess I'll need to fix that :)
> 
> 
> Or may be just move the branch that bundles T-M in into the trunk? This
> problem has been fixed in that branch if I remember correctly.

well, I want to run that branch through a battery of tests before we go
and merge it into trunk - I, for one, have quite a bit of testing code
that relies on proper Test::More support, so if that all ends up working
we're probably good to go.

has this issue been resolved yet?

http://marc.theaimsgroup.com/?l=apache-modperl-test-dev&m=111512322421210&w=2

--Geoff

Re: Apache::Test v1.25 error - Can't use string ("Test::Builder") as a HASH ref

Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:
>>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.
> 
> 
> well, it's not exactly a bug - it looks like Test::Builder changed
> reset() from a class method to an object method since that code was written.
> 
> I guess I'll need to fix that :)

Or may be just move the branch that bundles T-M in into the trunk? This
problem has been fixed in that branch if I remember correctly.


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: Apache::Test v1.25 error - Can't use string ("Test::Builder") as a HASH ref

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> 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.

well, it's not exactly a bug - it looks like Test::Builder changed
reset() from a class method to an object method since that code was written.

I guess I'll need to fix that :)

--Geoff