1smartmatch(3) User Contributed Perl Documentation smartmatch(3)
2
3
4
6 smartmatch - pluggable smart matching backends
7
9 version 0.03
10
12 1 ~~ 2; # false
13 {
14 use smartmatch sub { 1 };
15 1 ~~ 2; # true
16
17 no smartmatch;
18 1 ~~ 2; # false
19
20 use smartmatch 'custom';
21 1 ~~ 2; # smartmatch::engine::custom::match(1, 2)
22 }
23 1 ~~ 2; # false
24
26 NOTE: This module is still experimental, and the API may change at any
27 point. You have been warned!
28
29 This module allows you to override the behavior of the smart match
30 operator ("~~"). "use smartmatch $matcher" hooks into the compiler to
31 replace the smartmatch opcode with a call to a custom subroutine,
32 specified either as a coderef or as a string, which will have
33 "smartmatch::engine::" prepended to it and used as the name of a
34 package in which to find a subroutine named "match". The subroutine
35 will be called with two arguments, the values on the left and right
36 sides of the smart match operator, and should return the result.
37
38 This module is lexically scoped, and you can call "no smartmatch" to
39 restore the core perl smart matching behavior.
40
42 No known bugs.
43
44 Please report any bugs through RT: email "bug-smartmatch at
45 rt.cpan.org", or browse to
46 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=smartmatch>.
47
49 Please see those modules/websites for more information related to this
50 module.
51
52 · "Smart matching in detail" in perlsyn
53
54 · smartmatch::engine::core
55
57 You can find this documentation for this module with the perldoc
58 command.
59
60 perldoc smartmatch
61
62 You can also look for information at:
63
64 · AnnoCPAN: Annotated CPAN documentation
65
66 <http://annocpan.org/dist/smartmatch>
67
68 · CPAN Ratings
69
70 <http://cpanratings.perl.org/d/smartmatch>
71
72 · RT: CPAN's request tracker
73
74 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=smartmatch>
75
76 · Search CPAN
77
78 <http://search.cpan.org/dist/smartmatch>
79
81 Jesse Luehrs <doy at tozt dot net>
82
84 This software is copyright (c) 2011 by Jesse Luehrs.
85
86 This is free software; you can redistribute it and/or modify it under
87 the same terms as the Perl 5 programming language system itself.
88
89
90
91perl v5.12.4 2011-07-10 smartmatch(3)