.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Class::MOP::Overload 3"
.TH Class::MOP::Overload 3 "2021-11-07" "perl v5.26.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Class::MOP::Overload \- Overload Meta Object
.SH "VERSION"
.IX Header "VERSION"
version 2.2201
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 2
\& my $meta = Class\->meta;
\& my $overload = $meta\->get_overloaded_operator(\*(Aq+\*(Aq);
\&
\& if ( $overload\->has_method_name ) {
\& print \*(AqMethod for + is \*(Aq, $overload\->method_name, "\en";
\& }
\& else {
\& print \*(AqOverloading for + is implemented by \*(Aq,
\& $overload\->coderef_name, " sub\en";
\& }
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This class provides meta information for overloading in classes and roles.
.SH "INHERITANCE"
.IX Header "INHERITANCE"
\&\f(CW\*(C`Class::MOP::Overload\*(C'\fR is a subclass of Class::MOP::Object.
.SH "METHODS"
.IX Header "METHODS"
.SS "Class::MOP::Overload\->new(%options)"
.IX Subsection "Class::MOP::Overload->new(%options)"
This method creates a new \f(CW\*(C`Class::MOP::Overload\*(C'\fR object. It accepts a number
of options:
.IP "\(bu" 4
operator
.Sp
This is a string that matches an operator known by the overload module,
such as \f(CW""\fR or \f(CW\*(C`+\*(C'\fR. This is required.
.IP "\(bu" 4
method_name
.Sp
The name of the method which implements the overloading. Note that this does
not need to actually correspond to a real method, since it's okay to declare a
not-yet-implemented overloading.
.Sp
Either this or the \f(CW\*(C`coderef\*(C'\fR option must be passed.
.IP "\(bu" 4
method
.Sp
A Class::MOP::Method object for the method which implements the
overloading.
.Sp
This is optional.
.IP "\(bu" 4
coderef
.Sp
A coderef which implements the overloading.
.Sp
Either this or the \f(CW\*(C`method_name\*(C'\fR option must be passed.
.IP "\(bu" 4
coderef_package
.Sp
The package where the coderef was defined.
.Sp
This is required if \f(CW\*(C`coderef\*(C'\fR is passed.
.IP "\(bu" 4
coderef_name
.Sp
The name of the coderef. This can be \*(L"_\|_ANON_\|_\*(R".
.Sp
This is required if \f(CW\*(C`coderef\*(C'\fR is passed.
.IP "\(bu" 4
associated_metaclass
.Sp
A Class::MOP::Module object for the associated class or role.
.Sp
This is optional.
.ie n .SS "$overload\->operator"
.el .SS "\f(CW$overload\fP\->operator"
.IX Subsection "$overload->operator"
Returns the operator for this overload object.
.ie n .SS "$overload\->method_name"
.el .SS "\f(CW$overload\fP\->method_name"
.IX Subsection "$overload->method_name"
Returns the method name that implements overloading, if it has one.
.ie n .SS "$overload\->has_method_name"
.el .SS "\f(CW$overload\fP\->has_method_name"
.IX Subsection "$overload->has_method_name"
Returns true if the object has a method name.
.ie n .SS "$overload\->method"
.el .SS "\f(CW$overload\fP\->method"
.IX Subsection "$overload->method"
Returns the Class::MOP::Method that implements overloading, if it has one.
.ie n .SS "$overload\->has_method"
.el .SS "\f(CW$overload\fP\->has_method"
.IX Subsection "$overload->has_method"
Returns true if the object has a method.
.ie n .SS "$overload\->coderef"
.el .SS "\f(CW$overload\fP\->coderef"
.IX Subsection "$overload->coderef"
Returns the coderef that implements overloading, if it has one.
.ie n .SS "$overload\->has_coderef"
.el .SS "\f(CW$overload\fP\->has_coderef"
.IX Subsection "$overload->has_coderef"
Returns true if the object has a coderef.
.ie n .SS "$overload\->coderef_package"
.el .SS "\f(CW$overload\fP\->coderef_package"
.IX Subsection "$overload->coderef_package"
Returns the package for the coderef that implements overloading, if it has
one.
.ie n .SS "$overload\->has_coderef"
.el .SS "\f(CW$overload\fP\->has_coderef"
.IX Subsection "$overload->has_coderef"
Returns true if the object has a coderef package.
.ie n .SS "$overload\->coderef_name"
.el .SS "\f(CW$overload\fP\->coderef_name"
.IX Subsection "$overload->coderef_name"
Returns the sub name for the coderef that implements overloading, if it has
one.
.ie n .SS "$overload\->has_coderef_name"
.el .SS "\f(CW$overload\fP\->has_coderef_name"
.IX Subsection "$overload->has_coderef_name"
Returns true if the object has a coderef name.
.ie n .SS "$overload\->is_anonymous"
.el .SS "\f(CW$overload\fP\->is_anonymous"
.IX Subsection "$overload->is_anonymous"
Returns true if the overloading is implemented by an anonymous coderef.
.ie n .SS "$overload\->associated_metaclass"
.el .SS "\f(CW$overload\fP\->associated_metaclass"
.IX Subsection "$overload->associated_metaclass"
Returns the Class::MOP::Module (class or role) that is associated with the
overload object.
.ie n .SS "$overload\->clone"
.el .SS "\f(CW$overload\fP\->clone"
.IX Subsection "$overload->clone"
Clones the overloading object, setting \f(CW\*(C`original_overload\*(C'\fR in the process.
.ie n .SS "$overload\->original_overload"
.el .SS "\f(CW$overload\fP\->original_overload"
.IX Subsection "$overload->original_overload"
For cloned objects, this returns the Class::MOP::Overload object from which
they were cloned. This can be used to determine the source of an overloading
in a class that came from a role, for example.
.SH "AUTHORS"
.IX Header "AUTHORS"
.IP "\(bu" 4
Stevan Little <stevan@cpan.org>
.IP "\(bu" 4
Dave Rolsky <autarch@urth.org>
.IP "\(bu" 4
Jesse Luehrs <doy@cpan.org>
.IP "\(bu" 4
Shawn M Moore <sartak@cpan.org>
.IP "\(bu" 4
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
.IP "\(bu" 4
Karen Etheridge <ether@cpan.org>
.IP "\(bu" 4
Florian Ragwitz <rafl@debian.org>
.IP "\(bu" 4
Hans Dieter Pearcey <hdp@cpan.org>
.IP "\(bu" 4
Chris Prather <chris@prather.org>
.IP "\(bu" 4
Matt S Trout <mstrout@cpan.org>
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
This software is copyright (c) 2006 by Infinity Interactive, Inc.
.PP
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.