App-Saisons

 view release on metacpan or  search on metacpan

lib/App/Saisons/UI.pm  view on Meta::CPAN

        ? ($session->{title}, $session->{cwd}, $query)
        : (lc $session->{title}, lc $session->{cwd}, lc $query);
    return {} if index($title, $q) >= 0;
    return {} if index($cwd,   $q) >= 0;
    my $re = _qr($query) or return undef;
    my @files;
    push @files, $session->{_file} if $session->{_file} && -f $session->{_file};
    if (my $dir = $session->{_dir}) {
        push @files, _find_jsonl_files($dir);
    }
    @files = sort { ((stat($b))[9] // 0) <=> ((stat($a))[9] // 0) } @files;
    my @rows;
    my $found = 0;
    for my $file (@files) {
        last if $found >= MAX_MATCH_LINES;
        open my $fh, '<', $file or next;
        my @lines;
        while (my $l = <$fh>) {
            no warnings 'utf8';
            push @lines, decode('UTF-8', $l, Encode::FB_DEFAULT);
        }



( run in 0.684 second using v1.01-cache-2.11-cpan-500dd33cbaf )