File Coverage

lib/CPAN/Audit/Discover.pm
Criterion Covered Total %
statement 20 22 90.9
branch 2 4 50.0
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 28 34 82.3


line stmt bran cond sub pod time code
1             package CPAN::Audit::Discover;
2 13     13   66 use strict;
  13         18  
  13         420  
3 13     13   43 use warnings;
  13         26  
  13         517  
4 13     13   4800 use CPAN::Audit::Discover::Cpanfile;
  13         35  
  13         453  
5 13     13   5016 use CPAN::Audit::Discover::CpanfileSnapshot;
  13         33  
  13         2001  
6              
7             our $VERSION = "1.001";
8              
9             sub new {
10 8     8 0 32 my $class = shift;
11              
12 8         15 my $self = {};
13 8         16 bless $self, $class;
14              
15 8         34 return $self;
16             }
17              
18             sub discover {
19 3     3 0 6 my $self = shift;
20 3         6 my ($path) = @_;
21              
22 3 50       141 if ( -f "$path/cpanfile.snapshot" ) {
    50          
23 0         0 return CPAN::Audit::Discover::CpanfileSnapshot->new->discover("$path/cpanfile.snapshot");
24             }
25             elsif ( -f "$path/cpanfile" ) {
26 3         32 return CPAN::Audit::Discover::Cpanfile->new->discover("$path/cpanfile");
27             }
28             else {
29             }
30              
31 0           return;
32             }
33              
34             1;