package overload;
-our $VERSION = '1.30';
+our $VERSION = '1.31';
%ops = (
with_assign => "+ - * / % ** << >> x .",
=head3 Declaration
Arguments of the C<use overload> directive are (key, value) pairs.
-For the full set of legal keys, see L<Overloadable Operations> below.
+For the full set of legal keys, see L</Overloadable Operations> below.
Operator implementations (the values) can be subroutines,
references to subroutines, or anonymous subroutines
Perl may also use C<minus()> to implement other operators which
have not been specified in the C<use overload> directive,
-according to the rules for L<Magic Autogeneration> described later.
+according to the rules for L</Magic Autogeneration> described later.
For example, the C<use overload> above declared no subroutine
for any of the operators C<-->, C<neg> (the overload key for
unary minus), or C<-=>. Thus
Perl takes care of the assignment to $x.
In fact, such methods should I<not> modify their operands,
even if C<undef> is passed as the third argument
-(see L<Overloadable Operations>).
+(see L</Overloadable Operations>).
The same is not true of implementations of C<++> and C<-->:
these are expected to modify their operand.
Note: the preceding paragraph describes what happens when
Perl autogenerates the copy constructor for an object based
on a scalar.
-For other cases, see L<Copy Constructor>.
+For other cases, see L</Copy Constructor>.
=head2 Overloadable Operations
&= |= ^= &.= |.= ^.=
Simple assignment is not overloadable (the C<'='> key is used
-for the L<Copy Constructor>).
+for the L</Copy Constructor>).
Perl does have a way to make assignments to an object do whatever
you want, but this involves using tie(), not overload -
see L<perlfunc/tie> and the L</COOKBOOK> examples below.
nomethod fallback =
-See L<Special Keys for C<use overload>>.
+See L</Special Keys for C<use overload>>.
=back
Note also that the copy constructor (key C<'='>) may be
autogenerated, but only for objects based on scalars.
-See L<Copy Constructor>.
+See L</Copy Constructor>.
=head3 Minimal Set of Overloaded Operations
catch_all($a, 3, 1, '+')
-See L<How Perl Chooses an Operator Implementation>.
+See L</How Perl Chooses an Operator Implementation>.
=head3 C<fallback>
use overload "fallback" => 0, # ... ;
-This disables L<Magic Autogeneration>.
+This disables L</Magic Autogeneration>.
=item * C<undef>
is allowed to revert to what it would have done for that
operator if there had been no C<use overload> directive.
-Note: in most cases, particularly the L<Copy Constructor>,
+Note: in most cases, particularly the L</Copy Constructor>,
this is unlikely to be appropriate behaviour.
=back
-See L<How Perl Chooses an Operator Implementation>.
+See L</How Perl Chooses an Operator Implementation>.
=head3 Copy Constructor
As there is no way to instruct Perl to treat the operands as, e.g.,
numbers instead of strings, the result here may not be what you
expect.
-See L<BUGS AND PITFALLS>.
+See L</BUGS AND PITFALLS>.
=head2 Losing Overloading
}
Since subroutines implementing assignment operators are not required
-to modify their operands (see L<Overloadable Operations> above),
+to modify their operands (see L</Overloadable Operations> above),
we do not need anything special to make C<+=> and friends work,
besides adding these operators to %subr and defining a copy
constructor (needed since Perl has no way to know that the
implementation of C<'+='> does not mutate the argument -
-see L<Copy Constructor>).
+see L</Copy Constructor>).
To implement a copy constructor, add C<< '=' => \&cpy >> to C<use overload>
line, and code (this code assumes that mutators change things one level