File Coverage

blib/lib/App/perlfind/Plugin/FoundIn.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package App::perlfind::Plugin::FoundIn;
2 10     10   1144993 use strict;
  10         29  
  10         507  
3 10     10   56 use warnings;
  10         29  
  10         419  
4 10     10   1055 use App::perlfind;
  10         16  
  10         694  
5             our $VERSION = '2.07';
6              
7             # Specify like this because it's easier. We compute the reverse later (i.e.,
8             # it should be easier on the hacker than on the computer).
9             #
10             # Note: 'for' is a keyword for perlpod as well ('=for'), but is listed for
11             # perlsyn here, as that's more likely to be the intended meaning.
12             our %found_in = (
13             perlop => [
14             qw(lt gt le ge eq ne cmp not and or xor
15             q qq qr qx qw \l \u \L \U \Q \E)
16             ],
17             perlsyn => [qw(if else elsif unless while until for foreach)],
18             perlobj => [qw(isa ISA can VERSION)],
19             perlsub => [qw(AUTOLOAD DESTROY)],
20             perlmod => [qw(BEGIN UNITCHECK CHECK INIT END)],
21             perltie => [
22             qw(TIESCALAR TIEARRAY TIEHASH TIEHANDLE FETCH STORE UNTIE
23             FETCHSIZE STORESIZE POP PUSH SHIFT UNSHIFT SPLICE DELETE EXISTS
24             EXTEND CLEAR FIRSTKEY NEXTKEY WRITE PRINT PRINTF READ READLINE GETC
25             CLOSE)
26             ],
27             perlrun => [
28             qw(HOME LOGDIR PATH PERL5LIB PERL5OPT PERLIO PERLIO_DEBUG PERLLIB
29             PERL5DB PERL5DB_THREADED PERL5SHELL PERL_ALLOW_NON_IFS_LSP
30             PERL_DEBUG_MSTATS PERL_DESTRUCT_LEVEL PERL_DL_NONLAZY PERL_ENCODING
31             PERL_HASH_SEED PERL_HASH_SEED_DEBUG PERL_ROOT PERL_SIGNALS
32             PERL_UNICODE)
33             ],
34             perlpod => [ map { ($_, "=$_") }
35             qw(head1 head2 head3 head4 over item back cut pod begin end)
36             ],
37             perldata => [qw(__DATA__ __END__)],
38              
39             # We could also list common functions and methods provided by some
40             # commonly used modules, like:
41             Moose => [
42             qw(has before after around super override inner augment confessed
43             extends with)
44             ],
45             Error => [qw(try catch except otherwise finally record)],
46             Storable => [qw(freeze thaw)],
47             Carp => [qw(carp cluck croak confess shortmess longmess)],
48             'Test::More' => [
49             qw(plan use_ok require_ok ok is isnt like unlike cmp_ok
50             is_deeply diag can_ok isa_ok pass fail eq_array eq_hash eq_set skip
51             todo_skip builder SKIP: TODO:)
52             ],
53             'Getopt::Long' => [qw(GetOptions)],
54             'File::Find' => [qw(find finddepth)],
55             'File::Path' => [qw(mkpath rmtree)],
56             'File::Spec' => [
57             qw(canonpath catdir catfile curdir devnull rootdir
58             tmpdir updir no_upwards case_tolerant file_name_is_absolute path
59             splitpath splitdir catpath abs2rel rel2abs)
60             ],
61             'File::Basename' => [
62             qw(fileparse fileparse_set_fstype basename
63             dirname)
64             ],
65             'File::Temp' => [
66             qw(tempfile tempdir tmpnam tmpfile mkstemp mkstemps
67             mkdtemp mktemp unlink0 safe_level)
68             ],
69             'File::Copy' => [qw(copy move cp mv rmscopy)],
70             'PerlIO' =>
71             [qw(:bytes :crlf :mmap :perlio :pop :raw :stdio :unix :utf8 :win32)],
72             );
73              
74             App::perlfind->add_trigger(
75             'matches.add' => sub {
76             my ($class, $word, $matches) = @_;
77             while (my ($file, $words) = each our %found_in) {
78             for (@$words) {
79             push @$matches, $file if $_ eq $$word;
80             }
81             }
82             }
83             );
84             1;
85             __END__