1Devel::OverloadInfo(3)User Contributed Perl DocumentationDevel::OverloadInfo(3)
2
3
4

NAME

6       Devel::OverloadInfo - introspect overloaded operators
7

VERSION

9       version 0.005
10

DESCRIPTION

12       Devel::OverloadInfo returns information about overloaded operators for
13       a given class (or object), including where in the inheritance hierarchy
14       the overloads are declared and where the code implementing them is.
15

FUNCTIONS

17   is_overloaded
18          if (is_overloaded($class_or_object)) { ... }
19
20       Returns a boolean indicating whether the given class or object has any
21       overloading declared.  Note that a bare "use overload;" with no actual
22       operators counts as being overloaded.
23
24       Equivalent to overload::Overloaded(), but doesn't trigger various bugs
25       associated with it in versions of perl before 5.16.
26
27   overload_op_info
28           my $info = overload_op_info($class_or_object, $op);
29
30       Returns a hash reference with information about the specified
31       overloaded operator of the named class or blessed object.
32
33       Returns "undef" if the operator is not overloaded.
34
35       See "Overloadable Operations" in overload for the available operators.
36
37       The keys in the returned hash are as follows:
38
39       class
40           The name of the class in which the operator overloading was
41           declared.
42
43       code
44           A reference to the function implementing the overloaded operator.
45
46       code_name
47           The name of the function implementing the overloaded operator, as
48           returned by "sub_fullname" in Sub::Identify.
49
50       method_name (optional)
51           The name of the method implementing the overloaded operator, if the
52           overloading was specified as a named method, e.g. "use overload $op
53           => 'method';".
54
55       code_class (optional)
56           The name of the class in which the method specified by
57           "method_name" was found.
58
59       value (optional)
60           For the special "fallback" key, the value it was given in "class".
61
62   overload_info
63           my $info = overload_info($class_or_object);
64
65       Returns a hash reference with information about all the overloaded
66       operators of specified class name or blessed object.  The keys are the
67       overloaded operators, as specified in %overload::ops (see "Overloadable
68       Operations" in overload), and the values are the hashes returned by
69       "overload_op_info".
70

CAVEATS

72       Whether the "fallback" key exists when it has its default value of
73       "undef" varies between perl versions: Before 5.18 it's there, in later
74       versions it's not.
75

AUTHOR

77       Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
78
80       This software is copyright (c) 2014 by Dagfinn Ilmari Mannsåker.
81
82       This is free software; you can redistribute it and/or modify it under
83       the same terms as the Perl 5 programming language system itself.
84
85
86
87perl v5.32.0                      2020-07-28            Devel::OverloadInfo(3)
Impressum