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

Because I'm on the Perl.com newsletter mailing list, I learned recently about chromatic's fascinating series on Refactoring the Everything Engine. I was particularly intrigued with Test::MockObject because it addressed a weakness of one of my current development situations, that of being unable to test a web application in a controlled manner. (This is a whole other can of worms .. I'm trying to stay on topic here.)

So, all enthused, I went over to my FC4 test system and went to install Test::MockObject, only to see it fail as follows:

Running make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_h +arness(0, 'blib/lib', 'blib/arch')" t/*.t t/base............NOK 1# Failed test (t/base.t at line 8) + # Tried to use 'Test::MockObject'. # Error: Weak references are not implemented in the version of pe +rl at /root/.cpan/build/Test-MockObject-1.06/b lib/lib/Test/MockObject.pm line 9 # BEGIN failed--compilation aborted at /root/.cpan/build/Test-MockObje +ct-1.06/blib/lib/Test/MockObject.pm line 9. # Compilation failed in require at (eval 1) line 2. ...

I have done some research, and it's been suggested that Red Hat in general has this kind of problem. I'm using Perl 5.8.6, and I did do a yum -y update a week or two ago, so I believe things are up to date.

Thoughts?

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re: Weak references error when installing Test::MockObject
by gellyfish (Monsignor) on Apr 21, 2006 at 14:27 UTC

    You have Scalar::Util installed but it is either not the right version or it does not have the XS parts required for the weaken function to work, you may find this if you have a preinstalled perl for instance. Reinstall Scalar::Util and everything will be fine.

    /J\

      Thanks, that worked fine.

      I'm a little surprised that

      cpan -f -i Scalar::Util
      didn't do what I wanted, so I had to run the CPAN shell
      [root@carbon ~]# cpan cpan shell -- CPAN exploration and modules installation (v1.7601) ReadLine support enabled cpan> force install Scalar::Util ...
      to actually get it to do what I wanted.

      After that, Test::MockObject installed fine. Thanks a bunch!

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Re: Weak references error when installing Test::MockObject
by chromatic (Archbishop) on Apr 21, 2006 at 17:27 UTC

    I've seen that problem in other situations where you have an older version of Scalar::Util in @INC -- not the wrong version, just an older version than half of the code expects. It's an XS module, so there's a Perl part and a compiled part. When they get out of sync, weird things happen.