Sub::Way - several ways of matching
use Sub::Way qw/match/; if ( match($target_text, $condition) ) { # do something }
Sub::Way is the matching utility.
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'.
Sub::Way is hosted on github: http://github.com/bayashi/Sub-Way
Welcome your patches and issues :D
Dai Okabayashi <bayashi@cpan.org>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install Sub::Way, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sub::Way
CPAN shell
perl -MCPAN -e shell install Sub::Way
For more information on module installation, please visit the detailed CPAN module installation guide.