AIE/Method/SimpleLCS.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 31 CC 2 SCAR 13.9
CC
2
Cov
0%
AIE
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 4.0
1 package Org::FRDCSA::AIE::Method::SimpleLCS;
2  
3 use Algorithm::Diff qw(LCS);
4  
5 require Exporter;
6 @ISA = qw(Exporter);
7 @EXPORT = qw (AIE);
8  
9 sub AIE {
10 my %args = @_;
11 my $entries = $args{Entries};
12 my $size = scalar @$entries;
13 my @intermediate = split //, $entries->[0];
14 foreach my $i (0 .. ($size - 2)) {
15 @intermediate = LCS(\@intermediate,[split //, $entries->[$i + 1]]);
16 }
17 my $regex = join("(.*)",@intermediate);
18 print $regex."\n";
19 foreach my $entry (@$entries) {
20 my @results;
21 my @matches = $entry =~ /$regex/;
22 foreach my $match (@matches) {
23 if ($match ne "") {
24 push @results, $match;
25 }
26 }
27 push @all,\@results;
28 }
29 return \@all;
30 }
31  
32 1;