From: Jesse Luehrs Date: Sat, 10 Mar 2012 23:58:27 +0000 (-0600) Subject: documentation X-Git-Tag: 2.0500~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b7d4b35d8beb17c48cf3f08c386cf863d973a7db;p=gitmo%2FMoose.git documentation --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 8ad9349..65fb500 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -1954,6 +1954,48 @@ default, this is L. =back +=head2 Overload introspection and creation + +These methods provide an API to the core L functionality. + +=over 4 + +=item B<< $metaclass->is_overloaded >> + +Returns true if overloading is enabled for this class. Corresponds to +L. + +=item B<< $metaclass->get_overloaded_operator($op) >> + +Returns the L 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 for the list of valid operator names). + +=item B<< $metaclass->get_all_overloaded_operators >> + +Returns a list of L 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 diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index 0f96d22..5ec4f18 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -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. 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