in reply to Test scalar refs (not values) in deeply nested structure

The Test::More documentation says for is_deeply:

is_deeply() compares the dereferenced values of references, the references themselves (except for their type) are ignored.

... so I'm not sure what you expect.

If you want to compare the identity of the references too, you will need to write your own comparison tool, but I guess that a simple shallow comparison already is enough for that case.

Replies are listed 'Best First'.
Re^2: Test scalar refs (not values) in deeply nested structure
by LanX (Saint) on Jul 23, 2020 at 19:58 UTC
    unfortunately my data is far from being shallow.

    My pragmatic approach is to write a recursive diver which will replace the scalar values with the stringification of their refs.

    $$ref = "$ref"

    I'll feed this to is_deeply() then, seems to work so far.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      So you have a nested data structure, but you want only scalar refs to be compared for identity, while you want to compare everything else structurally?

      If that's not it, maybe show examples and counterexamples of what you want your comparison routine to do.