File Coverage

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


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