1Test2::Tools::Ref(3) User Contributed Perl Documentation Test2::Tools::Ref(3)
2
3
4
6 Test2::Tools::Ref - Tools for validating references.
7
9 This module contains tools that allow you to verify that something is a
10 ref. It also has tools to check if two refs are the same exact ref, or
11 different. None of the functions in this module do deep comparisons.
12
14 use Test2::Tools::Ref;
15
16 # Ensure something is a ref.
17 ref_ok($ref);
18
19 # Check that $ref is a HASH reference
20 ref_ok($ref, 'HASH', 'Must be a hash')
21
22 ref_is($refa, $refb, "Same exact reference");
23
24 ref_is_not($refa, $refb, "Not the same exact reference");
25
27 All subs are exported by default.
28
29 ref_ok($thing)
30 ref_ok($thing, $type)
31 ref_ok($thing, $type, $name)
32 This checks that $thing is a reference. If $type is specified then
33 it will check that $thing is that type of reference.
34
35 ref_is($ref1, $ref2, $name)
36 Verify that two references are the exact same reference.
37
38 ref_is_not($ref1, $ref2, $name)
39 Verify that two references are not the exact same reference.
40
42 The source code repository for Test2-Suite can be found at
43 https://github.com/Test-More/Test2-Suite/.
44
46 Chad Granum <exodist@cpan.org>
47
49 Chad Granum <exodist@cpan.org>
50
52 Copyright 2018 Chad Granum <exodist@cpan.org>.
53
54 This program is free software; you can redistribute it and/or modify it
55 under the same terms as Perl itself.
56
57 See http://dev.perl.org/licenses/
58
59
60
61perl v5.36.0 2023-03-23 Test2::Tools::Ref(3)