Class::MOP::Overload - Overload Meta Object
| Use Case | Command | Description |
|---|---|---|
| Create Overload Object | Class::MOP::Overload->new(%options) |
Creates a new overload meta object. |
| Get Overloaded Operator | $meta->get_overloaded_operator('+') |
Returns a Class::MOP::Overload object for the given operator. |
| Check Method Name | $overload->has_method_name |
Returns true if a method name is defined. |
| Get Method Name | $overload->method_name |
Returns the method name implementing the overload. |
| Clone Overload Object | $overload->clone |
Clones the overloading object, setting original_overload. |
version 2.2200
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.
Class::MOP::Overload->new(%options)This method creates a new Class::MOP::Overload object. It accepts a number of options:
"" or "+". This is required.coderef option must be passed.method_name option must be passed.coderef is passed."__ANON__". This is required if coderef is passed.$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 📦 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 🔗 (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 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.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.
Generated by phpman v4.9.26-5-g7740029 Author: Che Dong Under GNU General Public License
2026-08-14 20:40 @2600:1f28:365:80b0:4d23:66fa:c2bb:7bae
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)