1MakeMethods::Utility::RUesfe(r3)Contributed Perl DocumenMtaakteiMoenthods::Utility::Ref(3)
2
3
4
6 Class::MakeMethods::Utility::Ref - Deep copying and comparison
7
9 use Class::MakeMethods::Utility::Ref qw( ref_clone ref_compare );
10
11 $deep_copy = ref_clone( $original );
12 $positive_zero_or_negative = ref_compare( $item_a, $item_b );
13
15 This module provides utility functions to copy and compare arbitrary
16 references, including full traversal of nested data structures.
17
18 REFERENCE
19 The following functions are provided:
20
21 ref_clone()
22 Make a recursive copy of a reference.
23
24 ref_compare()
25 Attempt to recursively compare two references.
26
27 If they are not the same, try to be consistent about returning a
28 positive or negative number so that it can be used for sorting. The
29 sort order is kinda arbitrary.
30
32 See Class::MakeMethods for general information about this distribution.
33
34 See Ref for the original version of the clone and compare functions
35 used above.
36
37 See Clone (v0.09 on CPAN as of 2000-09-21) for a clone method with an
38 XS implementation.
39
40 The Perl6 RFP #67 proposes including clone functionality in the core.
41
42 See Data::Compare (v0.01 on CPAN as of 1999-04-24) for a Compare method
43 which checks two references for similarity, but it does not provide
44 positive/negative values for ordering purposes.
45
46
47
48perl v5.34.0 2022-01-21 MakeMethods::Utility::Ref(3)