GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Class::MOP::Overload(3) User Contributed Perl Documentation Class::MOP::Overload(3)

Class::MOP::Overload - Overload Meta Object

version 2.2201

    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";
    }

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

"Class::MOP::Overload" is a subclass of Class::MOP::Object.

This method creates a new "Class::MOP::Overload" object. It accepts a number of options:
  • operator

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

  • 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.

  • method

    A Class::MOP::Method object for the method which implements the overloading.

    This is optional.

  • coderef

    A coderef which implements the overloading.

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

  • coderef_package

    The package where the coderef was defined.

    This is required if "coderef" is passed.

  • coderef_name

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

    This is required if "coderef" is passed.

  • associated_metaclass

    A Class::MOP::Module object for the associated class or role.

    This is optional.

Returns the operator for this overload object.

Returns the method name that implements overloading, if it has one.

Returns true if the object has a method name.

Returns the Class::MOP::Method that implements overloading, if it has one.

Returns true if the object has a method.

Returns the coderef that implements overloading, if it has one.

Returns true if the object has a coderef.

Returns the package for the coderef that implements overloading, if it has one.

Returns true if the object has a coderef package.

Returns the sub name for the coderef that implements overloading, if it has one.

Returns true if the object has a coderef name.

Returns true if the overloading is implemented by an anonymous coderef.

Returns the Class::MOP::Module (class or role) that is associated with the overload object.

Clones the overloading object, setting "original_overload" in the process.

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.

  • Stevan Little <stevan@cpan.org>
  • Dave Rolsky <autarch@urth.org>
  • Jesse Luehrs <doy@cpan.org>
  • Shawn M Moore <sartak@cpan.org>
  • יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
  • Karen Etheridge <ether@cpan.org>
  • Florian Ragwitz <rafl@debian.org>
  • Hans Dieter Pearcey <hdp@cpan.org>
  • Chris Prather <chris@prather.org>
  • Matt S Trout <mstrout@cpan.org>

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.

2021-11-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.