summaryrefslogtreecommitdiff
path: root/lib/overload.pm
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-11-22 18:24:43 +0000
committerZefram <zefram@fysh.org>2017-11-22 19:13:09 +0000
commit1068631d8485410b2f8645d5413bbed47244a4a8 (patch)
tree8894b036e54ec951374a89d0e0304918f766e056 /lib/overload.pm
parent25233fb4d503834fd10cefc6b551240224a7f31a (diff)
downloadperl-1068631d8485410b2f8645d5413bbed47244a4a8.tar.gz
update doc in lib/ about smartmatch
Diffstat (limited to 'lib/overload.pm')
-rw-r--r--lib/overload.pm31
1 files changed, 3 insertions, 28 deletions
diff --git a/lib/overload.pm b/lib/overload.pm
index ba563143f1..45c48958e5 100644
--- a/lib/overload.pm
+++ b/lib/overload.pm
@@ -1,6 +1,6 @@
package overload;
-our $VERSION = '1.28';
+our $VERSION = '1.29';
%ops = (
with_assign => "+ - * / % ** << >> x .",
@@ -522,33 +522,8 @@ This overload was introduced in Perl 5.12.
=item * I<Matching>
The key C<"~~"> allows you to override the smart matching logic used by
-the C<~~> operator and the switch construct (C<given>/C<when>). See
-L<perlsyn/Switch Statements> and L<feature>.
-
-Unusually, the overloaded implementation of the smart match operator
-does not get full control of the smart match behaviour.
-In particular, in the following code:
-
- package Foo;
- use overload '~~' => 'match';
-
- my $obj = Foo->new();
- $obj ~~ [ 1,2,3 ];
-
-the smart match does I<not> invoke the method call like this:
-
- $obj->match([1,2,3],0);
-
-rather, the smart match distributive rule takes precedence, so $obj is
-smart matched against each array element in turn until a match is found,
-so you may see between one and three of these calls instead:
-
- $obj->match(1,0);
- $obj->match(2,0);
- $obj->match(3,0);
-
-Consult the match table in L<perlop/"Smartmatch Operator"> for
-details of when overloading is invoked.
+the C<~~> operator. See L<perlop/"Smartmatch Operator">.
+Unusually, the overloaded only takes effect for the right-hand operand.
=item * I<Dereferencing>