| 1 | 2 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package Dist::Zilla::Plugin::MetaData::BuiltWith::All; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | our $VERSION = '1.004005'; | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # ABSTRACT: Go overkill and report everything in all name-spaces. | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 2 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use Moose qw( extends has around ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 2 | extends 'Dist::Zilla::Plugin::MetaData::BuiltWith'; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 2 | has 'show_failures' => ( is => 'ro', isa => 'Bool', default => 0 ); | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 0 | ▶ | around dump_config => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 81 | 0 | my ( $orig, $self, @args ) = @_; | |||||||||||||||||||||||||||
| 82 | 0 | my $config = $self->$orig(@args); | |||||||||||||||||||||||||||
| 83 | 0 | my $payload = $config->{ +__PACKAGE__ } = {}; | |||||||||||||||||||||||||||
| 84 | 0 | $payload->{show_failures} = $self->show_failures; | |||||||||||||||||||||||||||
| 85 | 0 | ▶ | $payload->{ q[$] . __PACKAGE__ . q[::VERSION] } = $VERSION unless __PACKAGE__ eq ref $self; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | 0 | return $config; | |||||||||||||||||||||||||||
| 87 | 2 | }; | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 1 | ▶ | around '_metadata' => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 90 | 1 | my ( $orig, $self, @args ) = @_; | |||||||||||||||||||||||||||
| 91 | 1 | my $stash = $self->$orig(@args); | |||||||||||||||||||||||||||
| 92 | 1 | return { %{$stash}, %{ $self->_get_all() } }; | |||||||||||||||||||||||||||
| 93 | 2 | }; | |||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 96 | 2 | ▶ | no Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 1413 | ▶ | sub _list_modules_in_memory { | ||||||||||||||||||||||||||
|
Subroutine
_list_modules_in_memory: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 99 | 1413 | my ( $self, $package ) = @_; | |||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | 1413 | ▶ | return $package if 'main' eq $package or $package =~ /\Amain::/msx; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
"main" eq $package or $package =~ /\Amain::/msx
MC/DC50%1/2
"main" eq $package or $package =~ /\Amain::/msx
"main" eq $package
$package =~ /\Amain::/msx
Truth table66%2/3
A or B
A= "main" eq $packageB= $package =~ /\Amain::/msx
| |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 1412 | my $ns = do { | |||||||||||||||||||||||||||
| 104 | ## no critic (ProhibitNoStrict) | ||||||||||||||||||||||||||||
| 105 | 2 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 106 | 1412 | \%{ $package . q{::} }; | |||||||||||||||||||||||||||
| 107 | }; | ||||||||||||||||||||||||||||
| 108 | 1412 | my (@child_namespaces); | |||||||||||||||||||||||||||
| 109 | 1412 | for my $child ( keys %{$ns} ) { | |||||||||||||||||||||||||||
| 110 | 17789 | ▶ | next unless $child =~ /\A(.*)::$/msx; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | 1412 | my $child_pkg = $1; | |||||||||||||||||||||||||||
| 112 | 1412 | ▶ | $child_pkg = $package . q[::] . $child_pkg if $package; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | 1412 | push @child_namespaces, $child_pkg; | |||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 1412 | ▶ | return ( ( $package || () ), map { $self->_list_modules_in_memory($_) } @child_namespaces ); | ||||||||||||||||||||||||||
|
Condition66%2/3
$package || ()
MC/DC0%0/2
$package || ()
$package
()
Truth table66%2/3
A || B
A= $packageB= ()
| |||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 1 | ▶ | sub _get_all { | ||||||||||||||||||||||||||
|
Subroutine
_get_all: called CC=11 SCAR=30.2
| |||||||||||||||||||||||||||||
| 120 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 121 | 1 | my %modtable; | |||||||||||||||||||||||||||
| 122 | my %failures; | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 1 | for my $module ( $self->_list_modules_in_memory(q{}), $self->include ) { | |||||||||||||||||||||||||||
| 125 | 1412 | ▶ | if ( $module =~ /\A__ANON__/msx ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | 0 | $failures{$module} = 'Skipped: Anonymous Class'; | |||||||||||||||||||||||||||
| 127 | 0 | next; | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | 1412 | ▶ | if ( $module =~ /\[/msx ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | 0 | $failures{$module} = 'Skipped: Parameterized Type'; | |||||||||||||||||||||||||||
| 131 | 0 | next; | |||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | 1412 | my $result = $self->_detect_installed($module); | |||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 1412 | ▶ | $modtable{$module} = $result->[0] if defined $result->[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 136 | 1412 | ▶ | $failures{$module} = $result->[1] if defined $result->[1]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | 1 | for my $badmodule ( $self->exclude ) { | |||||||||||||||||||||||||||
| 141 | 0 | ▶ | delete $modtable{$badmodule} if exists $modtable{$badmodule}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | 0 | ▶ | delete $failures{$badmodule} if exists $failures{$badmodule}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | 1 | my $rval = { allmodules => \%modtable }; | |||||||||||||||||||||||||||
| 145 | 1 | ▶ | $rval->{allfailures} = \%failures if keys %failures and $self->show_failures; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
keys %failures and $self->show_failures
MC/DC0%0/2
keys %failures and $self->show_failures
keys %failures
$self->show_failures
Truth table33%1/3
A and B
A= keys %failuresB= $self->show_failures
| |||||||||||||||||||||||||||||
| 146 | 1 | return $rval; | |||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 2 | 1; | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | __END__ | ||||||||||||||||||||||||||||