This file is indexed.

/usr/share/perl5/Fennec/Finder.pm is in libfennec-perl 2.017-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
package Fennec::Finder;
use strict;
use warnings;

use base 'Fennec::Runner';

use File::Find qw/find/;
use Fennec::Util qw/accessors verbose_message/;
use List::Util qw/shuffle/;

accessors qw/test_files parallel/;

sub import {
    my $self = shift->new;
    $self->find_files(@_);
    $self->inject_run( scalar caller );
}

sub init {
    my $self = shift;
    my (%params) = @_;

    $self->test_files( [] );
    $self->parallel( defined $params{parallel} ? $params{parallel} : 2 );

    return $self;
}

sub find_files {
    my $self = shift;
    my @paths = @_ ? @_ : -d './t' ? ('./t') : ('./');

    find(
        {
            wanted => sub {
                my $file = $File::Find::name;
                return unless $self->validate_file($file);
                push @{$self->test_files} => $file;
            },
            no_chdir => 1,
        },
        @paths
    );
}

sub validate_file {
    my $self = shift;
    my ($file) = @_;
    return unless $file =~ m/\.(pm|ft)$/;
    return 1;
}

sub run {
    my $self = shift;
    my ($follow) = @_;

    $self->_ran(1);

    my $frunner = $self->prunner( $self->parallel );

    for my $file ( @{$self->test_files} ) {
        $frunner->run(
            sub {
                $self->load_file($file);

                for my $class ( shuffle @{$self->test_classes} ) {
                    next unless $class;
                    $self->run_test_class($class);
                }
            },
            1
        );

        $self->check_pid;
    }

    $frunner->finish();

    if ($follow) {
        $self->collector->collect;
        verbose_message("Entering final follow-up stage\n");
        eval { $follow->(); 1 } || $self->exception( 'done_testing', $@ );
    }

    $self->collector->collect;
    $self->collector->finish();
}

1;

__END__

=pod

=head1 NAME

Fennec::Finder - Create one .t file to find all .pm test files.

=head1 DESCRIPTION

Originally Fennec made use of a runner loaded in t/Fennec.t that sought out
test files (modules) to run. This modules provides similar, but greatly
simplified functionality.

=head1 SYNOPSIS

Fennec.t:

    #!/usr/bin/perl
    use strict;
    use warnings;

    use Fennec::Finder;

    run();

This will find all .pm and .ft files under t/ and load them. Any that contain
Fennec tests will register themselves to be run once run() is called.

B<Warning, if you have .pm files in t/ that are not tests they will also be
loaded, if any of these have interactions with the packages you are testing you
must account for them.>

=head1 CUSTOMISATIONS

=head2 SEARCH PATHS

When you C<use Fennec::Finder;> the './t/' directory will be searched if it
exists, otherwise the './' directory will be used. You may optionally provide
alternate paths at use time: C<use Fennec::Finder './Fennec', './SomeDir';>

    #!/usr/bin/perl
    use strict;
    use warnings;

    use Fennec::Finder './Fennec', './SomeDir';

    run();

=head2 FILE VALIDATION

If you wish to customize which files are loaded you may subclass
L<Fennec::Finder> and override the C<validate_file( $file )> method. This method takes
the filename to verify as an argument. Return true if the file should be
loaded, false if it should not. Currently the only check is that the filename
ends with a C<.pm>.

=head1 AUTHORS

Chad Granum L<exodist7@gmail.com>

=head1 COPYRIGHT

Copyright (C) 2013 Chad Granum

Fennec is free software; Standard perl license.

Fennec is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.

=cut