#-----------------------------------------------------------------------------
+# The following regex should be "qr{^ [^\t]+ \t}xms"
+# but it doesn't match when I expect it to. I
+# haven't figured out why. So I used [^\s]
+# as a substitue to mean "not a tab".
+
+my $NON_LEADING_TAB_REGEX = qr{^ [^\s]+ \t}xms;
+
+#-----------------------------------------------------------------------------
+
sub supported_parameters {
return (
{
return if $elem->parent->isa('PPI::Statement::Data');
# Permit leading tabs, if allowed
- return if $self->_allow_leading_tabs() && $elem->location->[1] == 1;
+ return if $self->_allow_leading_tabs() && $elem !~ $NON_LEADING_TAB_REGEX;
# Must be a violation...
return $self->violation( $DESC, $EXPL, $elem );
# common P::C testing tools
use Perl::Critic::TestUtils qw(pcritique fcritique);
-use Test::More tests => 6;
+use Test::More tests => 7;
#-----------------------------------------------------------------------------
is( pcritique($policy, \$code, \%config), 0, 'Tabs in qw()' );
#-----------------------------------------------------------------------------
+# RT #32440
+
+$code = <<"END_PERL";
+#This will be interpolated!
+\$x =~ m/
+\tsome
+\t(really | long)
+\tpattern
+/mx;
+END_PERL
+
+is( pcritique($policy, \$code, \%config), 0, 'Tabs in regex' );
+
+#-----------------------------------------------------------------------------
$code = <<"END_PERL";
##This will be interpolated!