Skip to content

Commit afaf583

Browse files
committed
change is_in_test_directory to use split & any instead of regex
1 parent 5338816 commit afaf583

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/MetaCPAN/Document/File.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use Moose;
88
use ElasticSearchX::Model::Document;
99

1010
use Encode;
11-
use List::MoreUtils qw(uniq);
11+
use List::MoreUtils qw(any uniq);
1212
use MetaCPAN::Document::Module;
1313
use MetaCPAN::Pod::XHTML;
1414
use MetaCPAN::Types qw(:all);
@@ -631,7 +631,8 @@ Returns true if the file is below a t directory.
631631

632632
sub is_in_test_directory {
633633
my $self = shift;
634-
return ( $self->path =~ /(^|\/)t($|\/)/ ? 1 : 0 );
634+
my @parts = split m{/}, $self->path;
635+
return ( any { $_ eq 't' } @parts ) ? 1 : 0;
635636
}
636637

637638
=head2 add_module

0 commit comments

Comments
 (0)