From: Vincent Pit Date: Wed, 4 Nov 2015 22:04:06 +0000 (-0200) Subject: Get rid of smart matches X-Git-Tag: v0.11~5 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Fre-engine-Plugin.git;a=commitdiff_plain;h=3cdbf09f4f3afe2781fe250cef854d82e3ec2c9e Get rid of smart matches Dumb matches are enough. --- diff --git a/Plugin.pod b/Plugin.pod index e69c8f4..4fc68bf 100644 --- a/Plugin.pod +++ b/Plugin.pod @@ -99,7 +99,7 @@ not be trapped by an C block that the pattern is in, i.e. comp => sub { my $rx = shift; croak "Your pattern is invalid" - unless $rx->pattern ~~ /pony/; + unless $rx->pattern =~ /pony/; } ); @@ -119,7 +119,7 @@ invalid pattern such as C. my ($rx, $str) = @_; # We always like ponies! - if ($str ~~ /pony/) { + if ($str =~ /pony/) { $ponies++; return 1; } @@ -164,7 +164,7 @@ L method. =head2 str - "str" ~~ /pattern/; + "str" =~ /pattern/; # in comp/exec/methods: my $str = $rx->str; @@ -187,7 +187,7 @@ hashrefs, objects, etc. =head2 mod my %mod = $rx->mod; - say "has /ix" if %mod ~~ 'i' and %mod ~~ 'x'; + say "has /ix" if %mod =~ 'i' and %mod =~ 'x'; A key-value pair list of the modifiers the pattern was compiled with. The keys will zero or more of C and the values will be true @@ -332,7 +332,7 @@ callbacks: my ($re, $paren) = @_; # This is perl's engine doing the match - $str ~~ /(.*)/; + $str =~ /(.*)/; # $1 has been untainted return $1; diff --git a/t/40-ctl/eval-comp.t b/t/40-ctl/eval-comp.t index 104f111..d70bbff 100644 --- a/t/40-ctl/eval-comp.t +++ b/t/40-ctl/eval-comp.t @@ -15,7 +15,7 @@ use re::engine::Plugin ( comp => sub { die "died at comp time" }, ); -eval { "str" ~~ /noes/ }; +eval { "str" =~ /noes/ }; TODO: { local $TODO = 'passing tests for known bug with how we handle eval';