|Perl Language Reference Manual|
by Larry Wall and others
Paperback (6"x9"), 724 pages
RRP £29.95 ($39.95)
Sales of this book support The Perl Foundation! Get a printed copy>>>
4.11.5 Custom matching via overloading
You can change the way that an object is matched by overloading
~~ operator. This may alter the usual smart match semantics.
It should be noted that
~~ will refuse to work on objects that
don't overload it (in order to avoid relying on the object's
Note also that smart match's matching rules take precedence over
overloading, so if
$obj has smart match overloading, then
$obj ~~ X
will not automatically invoke the overload method with X as an argument; instead the table above is consulted as normal, and based in the type of X, overloading may or may not be invoked.
See "Package for overloading Perl operations" (overload) in the Perl Library Reference Manual (Volume 1).
|ISBN 9781906966027||Perl Language Reference Manual||See the print edition|