documentation
Jesse Luehrs [Sat, 10 Mar 2012 23:58:27 +0000 (17:58 -0600)]
lib/Class/MOP/Class.pm
lib/Moose/Meta/Role.pm

index 8ad9349..65fb500 100644 (file)
@@ -1954,6 +1954,48 @@ default, this is L<Class::MOP::Attribute>.
 
 =back
 
+=head2 Overload introspection and creation
+
+These methods provide an API to the core L<overload> functionality.
+
+=over 4
+
+=item B<< $metaclass->is_overloaded >>
+
+Returns true if overloading is enabled for this class. Corresponds to
+L<overload::Overloaded|overload/Public Functions>.
+
+=item B<< $metaclass->get_overloaded_operator($op) >>
+
+Returns the L<Class::MOP::Method::Overload> object corresponding to the
+operator named C<$op>, if one exists for this class.
+
+=item B<< $metaclass->has_overloaded_operator($op) >>
+
+Returns whether or not the operator C<$op> is overloaded for this class.
+
+=item B<< $metaclass->get_overload_list >>
+
+Returns a list of operator names which have been overloaded (see
+L<overload/Overloadable Operations> for the list of valid operator names).
+
+=item B<< $metaclass->get_all_overloaded_operators >>
+
+Returns a list of L<Class::MOP::Method::Overload> objects corresponding to the
+operators that have been overloaded.
+
+=item B<< $metaclass->add_overloaded_operator($op, $impl) >>
+
+Overloads the operator C<$op> for this class, with the implementation C<$impl>.
+C<$impl> can be either a coderef or a method name. Corresponds to
+C<< use overload $op => $impl; >>
+
+=item B<< $metaclass->remove_overloaded_operator($op) >>
+
+Remove overloading for operator C<$op>. Corresponds to C<< no overload $op; >>
+
+=back
+
 =head2 Class Immutability
 
 Making a class immutable "freezes" the class definition. You can no
index 0f96d22..5ec4f18 100644 (file)
@@ -904,6 +904,31 @@ This is quite likely to change in the future.
 
 =back
 
+=head2 Overload introspection and creation
+
+The methods for dealing with a role's overloads are all identical in API
+and behavior to the same methods in L<Class::MOP::Class>. Note that these are
+not particularly useful (yet), because overloads do not participate in role
+composition.
+
+=over 4
+
+=item B<< $metarole->is_overloaded >>
+
+=item B<< $metarole->get_overloaded_operator($op) >>
+
+=item B<< $metarole->has_overloaded_operator($op) >>
+
+=item B<< $metarole->get_overload_list >>
+
+=item B<< $metarole->get_all_overloaded_operators >>
+
+=item B<< $metarole->add_overloaded_operator($op, $impl) >>
+
+=item B<< $metarole->remove_overloaded_operator($op) >>
+
+=back
+
 =head2 Required methods
 
 =over 4