Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

Devel::OverloadInfo

Name Devel::OverloadInfo
Version 0.007
Located at /usr/local/share/perl5
File /usr/local/share/perl5/Devel/OverloadInfo.pm
Is Core No
Search CPAN for this module Devel::OverloadInfo
Documentation Devel::OverloadInfo
Module Details Devel::OverloadInfo


NAME

Devel::OverloadInfo - introspect overloaded operators


VERSION

version 0.007


DESCRIPTION

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


FUNCTIONS

is_overloaded

   if (is_overloaded($class_or_object)) { ... }

Returns a boolean indicating whether the given class or object has any overloading declared. Note that a bare use overload; with no actual operators counts as being overloaded.

Equivalent to overload::Overloaded(), but doesn't trigger various bugs associated with it in versions of perl before 5.16.

overload_op_info

    my $info = overload_op_info($class_or_object, $op);

Returns a hash reference with information about the specified overloaded operator of the named class or blessed object.

Returns undef if the operator is not overloaded.

See overload/Overloadable Operations for the available operators.

The keys in the returned hash are as follows:

class
The name of the class in which the operator overloading was declared.

code
A reference to the function implementing the overloaded operator.

code_name
The fully qualified name of the function implementing the overloaded operator.

method_name (optional)
The name of the method implementing the overloaded operator, if the overloading was specified as a named method, e.g. use overload $op => 'method';.

code_class (optional)
The name of the class in which the method specified by method_name was found.

value (optional)
For the special fallback key, the value it was given in class.

overload_info

    my $info = overload_info($class_or_object);

Returns a hash reference with information about all the overloaded operators of specified class name or blessed object. The keys are the overloaded operators, as specified in %overload::ops (see overload/Overloadable Operations), and the values are the hashes returned by overload_op_info.


CAVEATS

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


AUTHOR

Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>


COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Dagfinn Ilmari Mannsåker.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024