File Coverage

blib/lib/App/Greple/wordle/util.pm
Criterion Covered Total %
statement 11 16 68.7
branch 0 2 0.0
condition 0 3 0.0
subroutine 4 5 80.0
pod 0 1 0.0
total 15 27 55.5


line stmt bran cond sub pod time code
1             package App::Greple::wordle::util;
2              
3 1     1   16 use v5.14;
  1         5  
4 1     1   6 use warnings;
  1         2  
  1         57  
5              
6 1     1   6 use Data::Dumper;
  1         3  
  1         70  
7              
8 1     1   6 use Exporter 'import';
  1         1  
  1         242  
9             our @EXPORT_OK = qw(uniqword);
10              
11             sub uniqword {
12 0     0 0   state @re;
13 0 0         my $len = length $_[0] or die;
14             my $re = $re[$len] //=
15             join('', '^(.)',
16             map {
17 0   0       sprintf "(%s.)", join '', map "(?!\\$_)", 1 .. $_;
  0            
18             } 1 .. $len - 1);
19 0           grep /^$re/i, @_;
20             }
21              
22             1;