NAME
match::smart - clone of smartmatch operator
SYNOPSIS
use v5.10;
use match::smart;
if ($this |M| $that)
{
say "$this matches $that";
}
DESCRIPTION
match::smart provides a simple match operator |M|
that acts like more or less identically to the (as of Perl 5.18) deprecated smart match operator.
While the real smart match operator implicitly takes references to operands that are hashes or arrays, match::smart's operator does not.
@foo ~~ %bar # means: \@foo ~~ \%bar
@foo |M| %bar # means: scalar(@foo) |M| scalar(%bar)
If you don't like the crazy Sub::Infix
operator, you can alternatively export a more normal function:
use v5.10;
use match::smart qw(match);
if (match($this, $that))
{
say "$this matches $that";
}
BUGS
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=match-simple.
SEE ALSO
This module uses Exporter::TypeTiny.
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.