Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Test::Deep - weak references are not implemented

by andreas1234567 (Vicar)
on Feb 01, 2008 at 12:14 UTC ( #665554=perlquestion: print w/ replies, xml ) Need Help??
andreas1234567 has asked for the wisdom of the Perl Monks concerning the following question:

I would like to use Test::Deep, which in turn requires Scalar::Util:
$ perl use strict; use warnings; use Test::Deep; __END__ Weak references are not implemented in the version of perl at /usr/lib +/perl5/5.8.5/Test/Deep/Cache/Simple.pm line 7
ENV:
Module id = Scalar::Util CPAN_VERSION 1.19 INST_VERSION 1.19 Module id = Test::Deep CPAN_VERSION 0.100 INST_VERSION 0.096 $ perl -v This is perl, v5.8.5 built for i386-linux-thread-multi $ uname -srvmpo Linux 2.6.9-55.0.12.EL #1 Fri Nov 2 10:57:39 EDT 2007 i686 i686 GNU/Li +nux
Is there anything I can do in order to use Test::Deep in the given environment? Alternatively, are there any other modules that allows testing of complex data structures?

Update Fri Feb 1 21:48:07 CET 2008: Resolved by a simple cpan> force install Scalar::Util. Many thanks to almut and chromatic for helpful advice.

--
Andreas

Comment on Test::Deep - weak references are not implemented
Select or Download Code
Re: Test::Deep - weak references are not implemented
by almut (Canon) on Feb 01, 2008 at 13:40 UTC

    That's kinda strange, as (IIRC) weak refs were introduced with v5.6.0. Also, FWIW, I can't replicate the problem with v5.8.4 (on Linux) with any combination of Scalar::Util 1.13 / 1.19 and Test::Deep 0.096 / 0.100.

    Other than that, there's a note in the current Test::Deep CHANGES file:

    0.099

    Don't explode on perl's that don't have weakrefs. If they're not available, just don't weaken the refs. It means refs can be cached for longer than desirable but it's better than explodiing.
    This doesn't fix all of te problems with perl 5.005 but I'm pushing it out because the previous version number upsets CPAN.pm.

    IOW, the current version should work (even with perls that truly don't support weak refs...).

Re: Test::Deep - weak references are not implemented
by chromatic (Archbishop) on Feb 01, 2008 at 18:43 UTC

    You probably have two versions of Scalar::Util installed. The .pm file for the version you're loading can't find its associated .so file, so you're not getting the XS version which adds weakref support.

    If you search your file system for Util.pm and Util.so, you'll probably find they're in very different places. Removing the old versions and reinstalling from the CPAN will likely solve the problem.

      Good hypothesis. And in fact, when moving away Util.so in all relevant places, I can reproduce the problem with Test::Deep 0.096 — but not with 0.100  (so, the note in the CHANGES file seems to be correct, with respect to the current version no longer insisting on weakref support).

Re: Test::Deep - weak references are not implemented
by backstab (Novice) on Feb 03, 2008 at 18:27 UTC
    is_deeply from Test::More might work for your needs...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://665554]
Approved by olus
Front-paged by halley
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2014-09-18 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (124 votes), past polls