# phpman > info > Class::MOP::Overload

[Class::MOP::Overload](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3AOverload/markdown)(3User Contributed Perl [DocumentaClass::MOP](https://www.chedong.com/phpMan.php/perldoc/DocumentaClass%3A%3AMOP/markdown)::[Overload(3pm)](https://www.chedong.com/phpMan.php/man/Overload/3pm/markdown)

NAME
       [Class::MOP::Overload](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3AOverload/markdown) - Overload Meta Object

VERSION
       version 2.2200

SYNOPSIS
           my $meta     = Class->meta;
           my $overload = $meta->get_overloaded_operator('+');

           if ( $overload->has_method_name ) {
               print 'Method for + is ', $overload->method_name, "\n";
           }
           else {
               print 'Overloading for + is implemented by ',
                   $overload->coderef_name, " sub\n";
           }

DESCRIPTION
       This class provides meta information for overloading in classes and
       roles.

INHERITANCE
       "[Class::MOP::Overload](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3AOverload/markdown)" is a subclass of [Class::MOP::Object](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3AObject/markdown).

METHODS
   [Class::MOP::Overload](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3AOverload/markdown)->new(%options)
       This method creates a new "[Class::MOP::Overload](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3AOverload/markdown)" object. It accepts a
       number of options:

       o   operator

           This is a string that matches an operator known by the overload
           module, such as "" or "+". This is required.

       o   method_name

           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.

           Either this or the "coderef" option must be passed.

       o   method

           A [Class::MOP::Method](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3AMethod/markdown) object for the method which implements the
           overloading.

           This is optional.

       o   coderef

           A coderef which implements the overloading.

           Either this or the "method_name" option must be passed.

       o   coderef_package

           The package where the coderef was defined.

           This is required if "coderef" is passed.

       o   coderef_name

           The name of the coderef. This can be "__ANON__".

           This is required if "coderef" is passed.

       o   associated_metaclass

           A [Class::MOP::Module](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3AModule/markdown) object for the associated class or role.

           This is optional.

   $overload->operator
       Returns the operator for this overload object.

   $overload->method_name
       Returns the method name that implements overloading, if it has one.

   $overload->has_method_name
       Returns true if the object has a method name.

   $overload->method
       Returns the [Class::MOP::Method](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3AMethod/markdown) that implements overloading, if it has
       one.

   $overload->has_method
       Returns true if the object has a method.

   $overload->coderef
       Returns the coderef that implements overloading, if it has one.

   $overload->has_coderef
       Returns true if the object has a coderef.

   $overload->coderef_package
       Returns the package for the coderef that implements overloading, if it
       has one.

   $overload->has_coderef
       Returns true if the object has a coderef package.

   $overload->coderef_name
       Returns the sub name for the coderef that implements overloading, if it
       has one.

   $overload->has_coderef_name
       Returns true if the object has a coderef name.

   $overload->is_anonymous
       Returns true if the overloading is implemented by an anonymous coderef.

   $overload->associated_metaclass
       Returns the [Class::MOP::Module](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3AModule/markdown) (class or role) that is associated with
       the overload object.

   $overload->clone
       Clones the overloading object, setting "original_overload" in the
       process.

   $overload->original_overload
       For cloned objects, this returns the [Class::MOP::Overload](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP%3A%3AOverload/markdown) 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.

AUTHORS
       o   Stevan Little <<stevan@cpan.org>>

       o   Dave Rolsky <<autarch@urth.org>>

       o   Jesse Luehrs <<doy@cpan.org>>

       o   Shawn M Moore <<sartak@cpan.org>>

       o    ' (Yuval Kogman) <<nothingmuch@woobling.org>>

       o   Karen Etheridge <<ether@cpan.org>>

       o   Florian Ragwitz <<rafl@debian.org>>

       o   Hans Dieter Pearcey <<hdp@cpan.org>>

       o   Chris Prather <<chris@prather.org>>

       o   Matt S Trout <<mstrout@cpan.org>>

COPYRIGHT AND LICENSE
       This software is copyright (c) 2006 by Infinity Interactive, Inc.

       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 v5.34.0                      2022-02-06         [Class::MOP](https://www.chedong.com/phpMan.php/perldoc/Class%3A%3AMOP/markdown)::[Overload(3pm)](https://www.chedong.com/phpMan.php/man/Overload/3pm/markdown)
