| 1 | package CPAN::Audit::Discover::Cpanfile; | ||||||||||
| 2 | 13 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 13 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 13 | ▶ | use Module::CPANfile; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 13 | our $VERSION = "1.001"; | |||||||||
| 7 | |||||||||||
| 8 | 3 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 9 | 3 | my $class = shift; | |||||||||
| 10 | |||||||||||
| 11 | 3 | my $self = {}; | |||||||||
| 12 | 3 | bless $self, $class; | |||||||||
| 13 | |||||||||||
| 14 | 3 | return $self; | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | 3 | ▶ | sub discover { | ||||||||
|
Subroutine
discover: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||
| 18 | 3 | my $self = shift; | |||||||||
| 19 | 3 | my ($cpanfile_path) = @_; | |||||||||
| 20 | |||||||||||
| 21 | 3 | my $cpanfile = Module::CPANfile->load($cpanfile_path); | |||||||||
| 22 | |||||||||||
| 23 | 3 | my $prereqs = $cpanfile->prereqs->as_string_hash; | |||||||||
| 24 | |||||||||||
| 25 | 3 | my @deps; | |||||||||
| 26 | 3 | foreach my $phase ( keys %$prereqs ) { | |||||||||
| 27 | 3 | foreach my $type ( keys %{ $prereqs->{$phase} } ) { | |||||||||
| 28 | 3 | foreach my $module ( keys %{ $prereqs->{$phase}->{$type} } ) { | |||||||||
| 29 | 7 | my $version = $prereqs->{$phase}->{$type}->{$module}; | |||||||||
| 30 | |||||||||||
| 31 | 7 | ▶ | next if $module eq 'perl'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | |||||||||||
| 33 | 5 | push @deps, | |||||||||
| 34 | { | ||||||||||
| 35 | module => $module, | ||||||||||
| 36 | version => $version, | ||||||||||
| 37 | }; | ||||||||||
| 38 | } | ||||||||||
| 39 | } | ||||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 3 | return @deps; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 13 | 1; | |||||||||