File Coverage

blib/lib/Acme/Spider.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 25 27 92.5


line stmt bran cond sub pod time code
1             package Acme::Spider;
2             $Acme::Spider::VERSION = '0.02';
3              
4             =head1 NAME
5              
6             Acme::Spider - frighten some other modules
7              
8             =head1 SYNOPSIS
9              
10             use Acme::Spider;
11              
12             =head1 DESCRIPTION
13              
14             Damian Conway is afraid of spiders, and all his code is afraid of this spider.
15              
16             =head1 TODO
17              
18             As the spider evolves, it will become better at recognising Damian's modules.
19             It's a pity evolution doesn't happen without some help.
20              
21             =cut
22              
23 1     1   733 use strict;
  1         3  
  1         39  
24 1     1   6 use warnings;
  1         2  
  1         34  
25 1     1   16 use Carp;
  1         1  
  1         226  
26              
27             my $re = do {
28             my @data = ;
29             chomp @data;
30             my $data = join '|', @data;
31             qr/^(?:$data)/;
32             };
33              
34             sub victim {
35 4     4 0 6 my ($file) = @_;
36 4         25 return scalar $file =~ $re;
37             }
38              
39             sub bite {
40 4     4 0 1844 my ($self, $file) = @_;
41             # we need to expand this test to include other Damian modules.
42 4 100       9 if (victim($file)) {
43 2         263 carp "$file doesn't like spiders";
44 2         1796 return 0;
45             }
46 2         82816 return undef;
47             }
48              
49 1     1   20 BEGIN { unshift @INC, \&bite }
50              
51             =head1 AUTHORS
52              
53             Marty Pauley Emarty@kasei.comE
54             Karen Pauley Ekaren@kasei.comE
55              
56             =head1 COPYRIGHT
57              
58             Copyright (C) 2006 Marty and Karen
59              
60             This program is free software; you can redistribute it and/or modify it under
61             the terms of either the GNU General Public License; either version 2 of the
62             License, or (at your option) any later version.
63              
64             This program is distributed in the hope that it will be useful, but WITHOUT
65             ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
66             FOR A PARTICULAR PURPOSE.
67              
68             =cut
69              
70             1;
71              
72             __DATA__