Algorithm-UrataniTakeda
view release on metacpan or search on metacpan
lib/Algorithm/UrataniTakeda.pm view on Meta::CPAN
To ensure consistent ordering, you need to use the L</search> method with a custom sort.
For example, to to get the keywords sorted by position and then longest-match-first, use:
my @raw;
$m->search( $text, sub ( $pos, $phrase ) { push @raw, [ $pos, $phrase ] } );
my @results =
map { $_->[1] }
sort { $a->[0] <=> $b->[0] || length( $b->[1] ) <=> length( $a->[1] ) }
@raw;
=head1 SEE ALSO
This implementation was based on
Uratani N. and Takeda M.,
"A Fast String-Searching Algorithm for Multiple Patterns", B<Information, Processing & Management 29 (6)>, pp. 775-791, 1993.
L<doi:10.1016/0306-4573(93)90106-N>.
=head1 SOURCE
t/00-report-prereqs.t view on Meta::CPAN
if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) {
push @dep_errors, "$mod is not installed ($req_string)";
}
}
}
if ( @reports ) {
push @full_reports, "=== $title ===\n\n";
my $ml = _max( map { length $_->[0] } @reports );
my $wl = _max( map { length $_->[1] } @reports );
my $hl = _max( map { length $_->[2] } @reports );
if ($type eq 'modules') {
splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports;
}
else {
splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl];
push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports;
}
( run in 1.991 second using v1.01-cache-2.11-cpan-54e63673c56 )