NAME
Sub::Way - several ways of matching
SYNOPSIS
use Sub::Way qw/match/;
if ( match($target_text, $condition) ) {
# do something
}
DESCRIPTION
Sub::Way is the matching utility.
METHOD
match($target, $condition, $and_opt)
sevelal ways below:
match('example text', 'amp'); # true
match('example text', qr/amp/); # true
match('example text', sub { my $t = shift; return 1 if $t =~ /^amp/; }); # true
match(
'example text',
[
'amp',
qr/amp/,
sub { my $t = shift; return 1 if $t =~ /^amp/; },
]
); # of course true
match(
'example text',
[
'yamp', # not match
qr/amp/,
sub { my $t = shift; return 1 if $t =~ /^amp/; },
],
1,
); # false
By default, the array of condition is evaluated as 'OR'.
REPOSITORY
Sub::Way is hosted on github: http://github.com/bayashi/Sub-Way
Welcome your patches and issues :D
AUTHOR
Dai Okabayashi <bayashi@cpan.org>
LICENSE
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.