NAME

smartmatch - pluggable smart matching backends

VERSION

version 0.03

SYNOPSIS

1 ~~ 2; # false
{
    use smartmatch sub { 1 };
    1 ~~ 2; # true

    no smartmatch;
    1 ~~ 2; # false

    use smartmatch 'custom';
    1 ~~ 2; # smartmatch::engine::custom::match(1, 2)
}
1 ~~ 2; # false

DESCRIPTION

NOTE: This module is still experimental, and the API may change at any point. You have been warned!

This module allows you to override the behavior of the smart match operator (~~). use smartmatch $matcher hooks into the compiler to replace the smartmatch opcode with a call to a custom subroutine, specified either as a coderef or as a string, which will have smartmatch::engine:: prepended to it and used as the name of a package in which to find a subroutine named match. The subroutine will be called with two arguments, the values on the left and right sides of the smart match operator, and should return the result.

This module is lexically scoped, and you can call no smartmatch to restore the core perl smart matching behavior.

BUGS

No known bugs.

Please report any bugs through RT: email bug-smartmatch at rt.cpan.org, or browse to http://rt.cpan.org/NoAuth/ReportBug.html?Queue=smartmatch.

SEE ALSO

Please see those modules/websites for more information related to this module.

SUPPORT

You can find this documentation for this module with the perldoc command.

perldoc smartmatch

You can also look for information at:

AUTHOR

Jesse Luehrs <doy at tozt dot net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Jesse Luehrs.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.